mdbtxt1
mdbtxt2
Proceed to Safety

Sequence A88995: The 32 and 3125 Property    

This sequence, Sloane's A88995, is officially titled "Least k>0 such that the first n digits of 2k and 5k are identical". It dates back to 1st December 2003, and a puzzle by T. Sillke from 2003 or earlier entitled "Powers of 2 and 5 Puzzle", which simply asks to find a number d that is the first digit of 2k and 5k for some k. Unless you count the trivial case of k=0, the first digit d is 3, which happens when 25=32 and 55=3125.

A little further investigation reveals that when the kth powers of 2 and of 5 agree in several of their initial digits, those digits are always the same as the digits of 10. For example, when the exponent k is 98, we get

298 = 316912650057057350374175801344
598 = 315544362088404722164691­42611­31144­91869­28257­40436­09201­90811­15722­65625

and these two numbers agree in the first 2 digits. 98 is the smallest exponent for which the powers of 2 and of 5 agree in the first 2 digits, so the 2nd term of sequence A88995 is 98.

As given in the OEIS, the sequence begins:

A88995 : 5, 98, 1068, 1068, 127185, 2728361, 15917834, 73482154, 961700165, 961700165, 83322853582, 1404948108914, 7603192018819, 167022179253602, 3550275020220728, 5729166542536373, 106675272785875442, ...

The OEIS gives this rather straightforward Mathematica program to compute and print the first 10 terms:

L2 = N[ Log[ 10, 2 ], 50 ]; L5 = N[ Log[ 10, 5 ], 50 ]; k = 1; Do[ While[ Take[ RealDigits[ 10^FractionalPart[ L2*k ]][[ 1 ]], n ] != Take[ RealDigits[ 10^FractionalPart[ L5*k ]][[ 1 ]], n ], k++ ]; Print[ k ], {n, 1, 10} ]

It uses 50 digits of precision and computes the lead digits in the most efficient way (avoiding calculation of all digits of 2k or 5k) by looking at the fractional parts of the base-10 logarithms of 2k and 5k.

There are also some Mathematica programs that do not work, according to those who have access to Mathematica. These programs appear to rely on hypotheses (eventually disproven) that the numbers in the sequence are all 1/2 of a denominator in a rational convergent (or continued fraction approximation) to log10(2), log10(5) and/or log10(5/2) (more on this approach below).

The working "one-liner" Mathematica programs are pretty slow because they don't bother checking to see if any given pair of values log10(2k) and log10(5k) are close to having the same fractional part before doing a 10x to get the leading digits. A simple range comparison of the fractional part of log10(2k)±log10(5k) with a suitable margin of error can filter out most of the failing k values and speed up the overall search.

Here is a C program that computes the first 8 terms of A88995 very quickly. It outputs:

k= 5 1 2^k=3.20000000000000000...e1 5^k=3.12500000000000000...e3 k= 98 2 2^k=3.1691265005705735...e29 5^k=3.1554436208840472...e68 3 (same as k=1068) k= 1068 4 2^k=3.162535207926729...e321 5^k=3.162020133383978...e746 k= 127185 5 2^k=3.1622669088034...e38286 5^k=3.1622884115699...e88898 k= 2728361 6 2^k=3.16227602475...e821318 5^k=3.16227929559...e1907042 k= 15917834 7 2^k=3.1622774595...e4791745 5^k=3.1622778608...e11126088 k= 73482154 8 2^k=3.1622776488...e22120332 5^k=3.1622776715...e51361821 At k=162882142, 5^k > 10^113849731 : insufficient precision to continue

It cannot go any further because it is using fixed-precision "long double" 80-bit floating point arithmetic.

Lead Digits and √10

It is fairly easy to see that the matching digits of the values of 2k and 5k will always be leading digits of √10. Consider the mantissa of any particular values of 2k and 5k, such as 3.2000... and 3.1250... in the first solution quoted above. These mantissas are always at least 1.0 and always less than 10.0. Because 2k×5k = 10k, the product of the two mantissas must be exactly 10. Since 2k and 5k are not themselves powers of 10, their mantissas are not exactly 1.0; but they must be fairly close to each other in order to have matching digits. There are two possibilities:

That T. Sillke page linked above mentions this but without explanation, leaping from "2n * 5n = 10n" straight to "We are looking for approximations of 2n = 10(m + 1/2)" and then starts looking at continued fractions.

Rational Approximations

Since the solutions k will produce values of 2k and 5k that share leading digits with √10, and each new record value of k matches more digits, we can use this closeness to √10 to see how the k values relate to rational approximations.

Consider k=5. The two values of 2k and 5k are 32 and 3125 respectively. Let's look at their logarithms to base 10, and give names to each of the integer and fractional parts of these logarithms:

a = log10(2k) = 1.50514...
i = floor(a) = 1
f = frac(a) = 0.50514...
b = log10(5k) = 3.49485...
j = floor(b) = 3
g = frac(b) = 0.49485...

Now express a instead as log10(2)×k, and express b as log10(5)×k, approximate f and g as 1/2, and construct these inequalities in which the ≈ symbol means "approximately equal to":

log10(2)×ki + 1/2
log10(5)×kj + 1/2

Both of these can be converted into a statement of rational approximation, by multiplying the right side by 2/2 and dividing both sides by k:

log10(2) ≈ (2i+1)/2k
log10(5) ≈ (2j+1)/2k

In both equations the thing on the right is an irreducible fraction because the numerator is odd and the denominator is even. Since log10(2)+log10(5) = 1, the two statements are equivalent, in the sense that if we find a rational convergent for log10(2) we can just subtract that rational fraction from 1 to get a rational convergent for log10(5). In either case, we have a value for 2k that gives a potential k value for sequence A088995.

The denominators of rational approximations to log10(2) are in OEIS sequence A73733, "Numerators of convergents to log2(10)":

A73733 : 1, 3, 10, 93, 196, 485, 2136, 13301, 28738, 42039, 70777, 254370, 325147, 6107016, 6432163, 44699994, 51132157, 146964308, 198096465, ...

We're only interested in the even ones because we want values for 2k; we could just ignore the odd ones here, or instead look at the numerators of convergents to log4(10), which should give values of k. Those that are actually terms of A88995 are highlighted here in bold:

Convergents to log4(10) (not in OEIS): 1/0, 1/1, 2/1, 3/2, 5/3, 93/56, 98/59, 485/292, 1068/643, 13301/8008, 14369/8651, 56408/33961, 70777/42612, 127185/76573, 325147/195758, ***, 3053508/1838395, 6432163/3872548, ***, 22349997/13456039, 51132157/30784626, 73482154/44240665, 271578619/163506621, 345060773/207747286, 616639392/371253907, 961700165/579001193, 82361153417/49586355312, ***, 248045160416/149338067129, 578451474249/348262489570, 1404948108914/845863046269, 6198243909905/3731714674646, 7603192018819/4577577720915, 13801435928724/8309292395561, 76610371662439/46124039698720, ***, 243632550916041/146681411491721, 563875473494521/339486862682162, 807508024410562/486168274173883, 1371383497905083/825655136856045, 2178891522315645/1311823411029928, 3550275020220728/2137478547885973, ...

There are a lot of extra numerators, which do indeed give solutions for the original problem of finding exponents k such that 2k and 5k share a lot of the same initial digits.

Some do not, namely those with even denominators: for example, we see a possible k=325147, but 2325147 = 1.000000360...×1097879 and 5325147 = 9.99999639...×10227267. Others like this are highlighted in italic above.

But there are others that are neither bold nor italic and look like legitimate candidates, such as 256408 = 3.162244...×1016980 and 556408 = 3.162311...×1039427. The only thing "wrong" with these is that they fail to give more matching digits than the smaller record-setter k=1068. This is bound to happen, as rational convergents tend to grow in size more slowly than the terms of A88995. So maybe we can get A88995 just by using rational convergents and ignoring any that don't set a record, and also ignore those with even denominators.

Unfortunately, and bad for our effort to compute A88995 quickly, is the fact that the convergents to log4(10) do not give all of the numbers we need: A88995 members 2728361 and 15917834 (and more, marked by "***" above) are missing.

However, many missing A88995 values are simple linear combinations of numerators from our convergent series. For example, the missing 2728361 is simply 3053508-325147, the difference of the numerators before and after the "***"; and similarly 15917834 is 22349997-6432163. Some take a little more work, like 83322853582 which is 248045160416-2×82361153417.

Playing Two Different Games

One might notice that the missing A88995 terms, marked with "***" in the list above, always immediately follow a term in italics which has an even denominator. These even-denominator fractions set a new record in the rational approximation game, but fail to be useful for A88995. It is up to some odd-denominator rational convergent, which might not itself set a rational approximation record, to meet A88995's requirements.

This approach, a hybrid of rational convergent numerators and linear combinations thereof, is the approach used in M.F. Hasler's Python and PARI programs, seen in the A88995 entry.

I will also mention the extensive discussion by Zhao Hui Du (in Chinese) on the Q&A site Zhihu, which I was able to read through Google Translate. It is mainly aimed at applying mathematical rigor to verify an approach attributed to Xianwen Wang (or "netizen Wayne"). The algorithm seems similar to the above, except using denominators of convergents to log10(5/2).

Other Pairs of Bases

Of course, this problem isn't exclusive to the numbers 2 and 5; however most other pairs of bases do not allow the extensive analysis and optimization presented above. For example, when the bases are 2 and 3, log10(2k) and log10(3k) do not satisfy a linear relation with rational coefficients. But other pairs, such as 4 and 5, do (because log10(4) + 2 log10(5) = 2). Here are some solutions for bases 2 and 3:

A88995-like sequence for bases 2 and 3 k= 17 1 2^k=1.31072000000000000...e5 3^k=1.29140163000000000...e8 k= 193 2 2^k=1.2554203470773362...e58 3^k=1.2145129806852985...e92 k= 619 3 2^k=2.175541218577478...e186 3^k=2.177993962169082...e295 k= 2016 4 2^k=7.524389324549355...e606 3^k=7.524012611682576...e961 5 (same as k=91958) k= 91958 6 2^k=1.3071976799241...e27682 3^k=1.3071984093386...e43875 k= 8186278 7 2^k=1.70154776402...e2464315 3^k=1.70154707496...e3905847 k= 45392361 8 2^k=1.7179395147...e13664462 3^k=1.7179395228...e21657660 At k=214590430, 3^k > 10^102385655 : insufficient precision to continue

for 2 and 4:

A88995-like sequence for bases 2 and 4 k= 7 1 2^k=1.28000000000000000...e2 4^k=1.63840000000000000...e4 k= 10 2 2^k=1.02400000000000000...e3 4^k=1.04857600000000000...e6 k= 196 3 2^k=1.004336277661869...e59 4^k=1.008691358627699...e118 k= 2136 4 2^k=1.00016289413762...e643 4^k=1.00032581480973...e1286 k= 28738 5 2^k=1.0000354408471...e8651 4^k=1.0000708829503...e17302 6 (same as k=325147) k= 325147 7 2^k=1.000000360340...e97879 4^k=1.000000720680...e195758 k= 6432163 8 2^k=1.00000004669...e1936274 4^k=1.00000009338...e3872548 At k=166260797, 4^k > 10^100098974 : insufficient precision to continue

and for 3 and 5:

A88995-like sequence for bases 3 and 5 1 (same as k=9) k= 9 2 3^k=1.96830000000000000...e4 5^k=1.95312500000000000...e6 3 (same as k=595) k= 595 4 3^k=7.711636641501210...e283 5^k=7.711743568329229...e415 k= 165712 5 3^k=5.216294524231...e79064 5^k=5.216251592981...e115827 6 (same as k=830345) k= 830345 7 3^k=1.771129016191...e396175 5^k=1.771129805024...e580386 k= 118902667 8 3^k=4.6618060498...e56730989 5^k=4.6618060382...e83109397 At k=144642767, 5^k > 10^101100955 : insufficient precision to continue

Victor Miller pointed out to the seqfan list that the American Mathematical Monthly published a problem in 2020 (which reverses the meanings of "n" and "k", which I have un-reversed here):

Problem 12174 (Proposed by Gregory Galperin and Yury J. Ionin)
(a) Let k be a positive integer, and suppose that the three leading digits of the decimal expansion of 4k are the same as the three leading digits of the decimal expansion of 5k. Find all possibilities for these three leading digits.
(b) Prove that for any positive integer n there exists a positive integer k such that the n leading digits of the decimal expansion of 4k are the same as the n leading digits of the decimal expansion of 5k.

The explicit search code above reveals two possible sets of three leading digits, namely 215 and 464.

A88995-like sequence for bases 4 and 5 k= 11 1 4^k=4.19430400000000000...e6 5^k=4.88281250000000000...e7 k= 31 2 4^k=4.6116860184273879...e18 5^k=4.6566128730773926...e21 k= 712 3 4^k=4.642092878335888...e428 5^k=4.641336831775293...e497 k= 1424 4 4^k=2.154902629109677...e857 5^k=2.154200758599391...e995 k= 84790 5 4^k=4.6415677924972...e51048 5^k=4.6415993542063...e59265 k= 2035672 6 4^k=4.64158786305...e1225596 5^k=4.64158931889...e1422873 k= 14899998 7 4^k=4.6415887299...e8970692 5^k=4.6415888855...e10414651 k= 66032155 8 4^k=4.6415888521...e39755318 5^k=4.6415888244...e46154495 At k=161864306, 5^k > 10^113138294 : insufficient precision to continue

The leading digits converge to the cube root of 10 and its square, i.e. 101/3 = 2.15443469003... and 4.64158883361... An analysis similar to above should work. One would need to approximate logarithms of 4n and 5n as rational numbers with fractional parts of 1/3 and 2/3, leading to "useful" numerators that are not a multiple of 3.


Robert Munafo's home pages on AWS    © 1996-2025 Robert P. Munafo.    about    contact
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. Details here.

This page was written in the "embarrassingly readable" markup language RHTF, and was last updated on 2025 Mar 26. s.30