10 P=1
20 repeat
30 P=P*2
40 P10=int(log(P)/log(10))+1
50 for K=1 to 9
60 N=K*10^P10+P
70 if N=2*P or N=4*P or N=8*P or N=16*P or N=32*P or N=64*P or N=128*P then
80 :print N:print P:print
90 next
100 until log(P)/log(10)>2000
The above checks powers of 2 up to 2000-digit numbers (an overkill, as we'll see). It finds the pairs (32,2) and (64,4).
Note that the higher power (2^A) can only be 2x, 4x, 8x, 16x, 32x or 64x the lower power (2^b). The 128x was thrown in for good measure.
Could any higher pair of powers work?
The following program considers all the possibilities mod 1000, to check to see if the last three digits of such power pairs could match, given that one must be 2, 4, 8, 16, 32 or 64 times the other:
10 for I=2 to 998 step 2
20 if (2*I)@1000=I then print I,2
30 if (4*I)@1000=I then print I,4
40 if (8*I)@1000=I then print I,8
50 if (16*I)@1000=I then print I,16
60 if (32*I)@1000=I then print I,32
70 if (64*I)@1000=I then print I,64
80 if (128*I)@1000=I then print I,128
90 next
Zero is not checked as no power of 2 can end in zero as such a number would have 5 as a factor.
The only results were:
200 16
400 16
600 16
800 16
This indicates that of the endings considered, only numbers ending in 200, 400, 600 or 800 would remain that way after multiplication by a power of 2 under 100. But a number ending in one of these three triplets of digits can't be a power of 2 itself.
So powers of 2 of more than three digits will not work. Therefore, only the two pairs found (32,2) and (64,4) work.
|
Posted by Charlie
on 2008-10-22 11:44:45 |