L is any integer other than a power of 10. M is any integer. Show that there is an integral power of L that begins with the sequence of digits given in M.
The following assumes that the common logarithm of any integer that's not an integral power of 10 will be a "normal number", that is, its digits can be taken to be "random" in the sense that all possible digits 0  9 occur with statistically equal frequency, all pairs of digits occur with equal frequency, all triplets the same, etc.
In order that the first several digits of a number (in this case the power sought) match a certain set of digits (those of the integer M), the mantissa of that power's logarithm must be within a certain finite range, around the mantissa of the logarithm of M.
Raising L to a power involves multiplying its logarithm (in this case using common logs) by the exponent to get the logarithm of the power. We can easily see that in the case of the exponent itself is a power of 10, that we're shifting the decimal point in the logarithm, and due to the presumed normality of the logarithm, shift any set of digits we want into the beginning of the mantissa (the fractional portion) so long as we find the appropriate digits, which we are assured of finding, with probability 1.
In fact, we of course do not need to make the exponent a power of 10that just makes the change in the mantissa a shifting of the decimal digits. As the exponent can be any integer, we'll get a larger variety of mantissas than just the shifteddigit ones.
Here's a program that seeks the exponent needed to raise a given L to result in a given number that starts with the digits of M:
5 point 15:cls
6 input "L,M:";L,M
7 Mdig=cutspc(str(M))
10 Lm=log(M)/log(10):Mant1=Lmint(Lm)
20 Ll=log(L)/log(10)
30 for K=1 to 800000
40 Lmt=Ll*K
50 Mant2=Lmtint(Lmt)
55 Tst=str(10^Mant2):Tst2=mid(Tst,2,1)+mid(Tst,4,len(Mdig)1)
60 if Tst2=Mdig then print K;int(Lmt);using(1,9),10^Mant2
80 ' if abs(Mant1Mant2)<0.5/M and Mant1<Mant2 then print K;int(Lmt);using(1,9),10^Mant2
90 next
100 goto 6
When asked, for example to find integral powers of 777 that begin 66666, it finds:
124113 358738 6.666631313
276624 799559 6.666605927
441391 1275805 6.666679153
593902 1716626 6.666653767
746413 2157447 6.666628381
meaning
777 ^ 124113 = 6.666631313 x 10^ 358738
777 ^ 276624 = 6.666605927 x 10^ 799559
777 ^ 441391 = 6.666679153 x 10^1275805
777 ^ 593902 = 6.666653767 x 10^1716626
777 ^ 746413 = 6.666628381 x 10^2157447
or, when asked to find powers of 12345 that begin 54321:
12345 ^ 92640 = 5.432165375 x 10^ 379035
12345 ^ 199481 = 5.432198924 x 10^ 816174
12345 ^ 314913 = 5.432118099 x 10^1288463
12345 ^ 421754 = 5.432151647 x 10^1725602
12345 ^ 528595 = 5.432185195 x 10^2162741
12345 ^ 644027 = 5.432104371 x 10^2635030
12345 ^ 750868 = 5.432137919 x 10^3072169

Posted by Charlie
on 20080131 14:04:02 