In article <
abednc4UX9bKi5XN...@vex.net>,
Mark Brader <
m...@vex.net> wrote:
>
>I didn't feel like performing a little calculator effort,
>so I let the computer do it.
>
>for ($b = 20; $b <= 70; ++$b) {
> for ($e = 1; ($y = $p = $b**$e) < 1e10; ++$e) {
> next if ($p < 1e9);
> $y =~ y/0123456789/6255456376/;
> $y =~ s/.(?=.)/$&+/g;
> if (eval $y == $b) { print "$b ^ $e == $p\n"; }
> }
>}
Your program looks similar to mine. So I'll have to make mine better.
>
>Sbegl-bar, juvpu gb gur fvkgu cbjre, rdhnyf sbhe ovyyvba, frira uhaqerq
>svsgl zvyyvba, bar uhaqerq sbhe gubhfnaq, gjb uhaqerq naq... sbegl-bar.
>
>A generalization of the program (with an "int()" added at the right
>place to keep it the numbers from stringifying into e-notation, and
>running on a 64-bit machine) also found these solutions for other
>lengths of displayed numbers:
Stopping at 64 bits misses all the big ones. Also you missed an easy one:
2 ^ 0 == 1
>
> 4 ^ 1 == 4
> 5 ^ 1 == 5
> 6 ^ 1 == 6
> 9 ^ 2 == 81
> 14 ^ 2 == 196
> 15 ^ 2 == 225
> 16 ^ 2 == 256
> 17 ^ 3 == 4913
> 24 ^ 4 == 331776
> 34 ^ 4 == 1336336
> 35 ^ 4 == 1500625
> 40 ^ 4 == 2560000
> 42 ^ 5 == 130691232
>
> 75 ^ 8 == 1001129150390625
use POSIX qw/ceil floor/;
use Math::BigInt;
for $length (1..80) {
for $base (2*$length..7*$length) {
$low=ceil(log(10**($length-1))/log($base));
$high=floor(log(10**$length-1)/log($base));
for $exp ($low..$high) {
$number=Math::BigInt->new($base)**$exp;
$segments=0;
for (split //, $number) {
$segments += [6,2,5,5,4,5,6,3,7,6]->[$_];
}
print "$number = $base**$exp\n" if $segments==$base;
}
}
}
1 = 2**0
4 = 4**1
5 = 5**1
6 = 6**1
81 = 9**2
196 = 14**2
225 = 15**2
256 = 16**2
4913 = 17**3
331776 = 24**4
1336336 = 34**4
1500625 = 35**4
2560000 = 40**4
130691232 = 42**5
4750104241 = 41**6
1001129150390625 = 75**8
34785499933455142617088 = 112**11
164621598066108688876929 = 129**11
36644198070556426025390625 = 135**12
5445099357697409441182253056 = 136**13
3851944592216835046631374058769 = 153**14
4219782742781494680756610809856 = 154**14
2396841004576526652464963814162432 = 168**15
1110832290554380967776058484990765121 = 179**16
3706098383855477888569066794413952001 = 193**16
3004194249508169189474100000000000000000 = 210**17
114445997944945591651333831028437092270721 = 191**18
199706440447672074115724080917060519353689 = 197**18
1674995299100251530712842240000000000000000000 = 240**19
43236604257134316980236244764745710476030343773831 = 231**21
608593231070356323694628994510802851679408972890112 = 262**21
241683916463563142652381132468772858902867169919443689 = 267**22
467238635183844819030587083139839879960967594223733852971 = 291**23
358610568238734050588013481916748923419045937990422148650881 = 303**24
55660922447187573821761251863649846565640419423580169677734375 = 295**25
100039974861910102703498287432152624971630259552770976678674432 = 302**25
497046239487669210557969596542183991928500855282446356218642432 = 322**25
8794368952544244511380553166755682451511431753012367724415811584 = 288**26
658342425356933454971404513472153229721600000000000000000000000000 = 340**26
31013532120049735812765414267081909623415233955385441617214865145856 = 316**27
89687304051847637884075194102700622397041458463607022855113137996169216 = 342**28
172699915887651284043051695330446821219172276612613421256906388442294904923 = 363**29
1105650802690002274712739583668764502538250138868380746276297584835891351827 = 387**29
211229219894208740169867072624253828290903690817409170918344522359571191169024 = 378**30
>
>This list may or may not be exhaustive; I was too lazy to work out the
>correct terminating conditioin.
New puzzle: does this list terminate? Processing gets slower with lots of
digits but the answers don't seem to be getting much farther apart.
--
Alan Curry