cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A088995 Least k > 0 such that the first n digits of 2^k and 5^k are identical.

This page as a plain text file.
%I A088995 #110 Mar 27 2025 23:13:37
%S A088995 5,98,1068,1068,127185,2728361,15917834,73482154,961700165,961700165,
%T A088995 83322853582,1404948108914,7603192018819,167022179253602,
%U A088995 3550275020220728,5729166542536373,106675272785875442,331484151442699072,2330288635428230258177,2330288635428230258177
%N A088995 Least k > 0 such that the first n digits of 2^k and 5^k are identical.
%C A088995 The number of matching first digits of 2^n and 5^n increases with n and forms the sequence 3,1,6,2,2,7,7,6,6,... which approaches sqrt(10).
%C A088995 Numbers are half of the denominator of some convergent to log_10(2). - J. Mulder (jasper.mulder(AT)planet.nl), Feb 03 2010 [WARNING: This holds only for n < 6, it is wrong from a(6) = 2728361 on: The denominators are ..., 325147, 6107016, ... which would yield the larger solution 3053508 for n = 6. - _M. F. Hasler_, Mar 20 2025]
%C A088995 _Xianwen Wang_ guesses that if the length of the continued fraction of m/k is h (where m is the difference between the numbers of digits of 2^k and 5^k), the first h-1 items of the continued fractions of m/k and log_10(2.5) agree. But this guess is not true for the similar sequence A359698. - _Zhao Hui Du_, Jun 06 2023
%C A088995 The terms grow like 10^n, oscillating by a few orders of magnitude around this value. I conjecture that log(a(n)/10^n) = O(log log n). - _M. F. Hasler_, Mar 22 2025
%H A088995 Zhao Hui Du, <a href="/A088995/b088995.txt">Table of n, a(n) for n = 1..1000</a>
%H A088995 Zhao Hui Du, <a href="https://zhuanlan.zhihu.com/p/634499178">Chinese page to introduce algorithm for a(n) to prove the guess of _Xianwen Wang_</a>
%H A088995 Robert Munafo, <a href="http://mrob.com/pub/seq/a088995.html">Sequence A88995: The 32 and 3125 Property</a>
%H A088995 T. Sillke, <a href="http://www.mathematik.uni-bielefeld.de/~sillke/PUZZLES/powers-2-5">Powers of 2 and 5 Puzzle</a>
%e A088995 a(2) = 98: 2^98 = 316912650057057350374175801344 and 5^98 = 315544362088404722164691426113114491869282574043609201908111572265625.
%t A088995 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} ]
%t A088995 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, 7} ]
%t A088995 f[n_, k_] := {Floor[ 10^(k - 1 + N[FractionalPart[n Log[5]/Log[10]], 20])], Floor[10^(k - 1 + N[FractionalPart[n Log[2]/Log[10]], 20])]} Flatten@Block[{$MaxExtraPrecision = \[Infinity]}, Block[{l = Denominator /@ Convergents[Log10[2], 1000]}, Array[k \[Function] l[[Flatten@Position[f[ #/2, k] & /@ l, {x_, x_}, {1}, 1]]]/2, 20]]] (* J. Mulder (jasper.mulder(AT)planet.nl), Feb 03 2010 *)
%t A088995 (* alternate program *)
%t A088995 n = 100; $MaxExtraPrecision = n; ans =
%t A088995  ContinuedFraction[Log10[5/2], n]; data =
%t A088995  Denominator /@
%t A088995   Flatten[Table[
%t A088995     FromContinuedFraction[Join[ans[[1 ;; p - 1]], {#}]] & /@
%t A088995      Range[1, ans[[p]]], {p, 2, n}]]; sol =
%t A088995  Select[Table[{k, a = N[FractionalPart[{k Log10[2], k Log10[5]}], n];
%t A088995     10^a, b = RealDigits[10^a][[All, 1]];
%t A088995     LengthWhile[Range[Length[b[[1]]]], b[[1, #]] == b[[2, #]] &],
%t A088995     10^a . {-1, 1}, RealDigits[10^a . {-1, 1}][[-1]]}, {k, data}],
%t A088995   Abs[#[[-2]]] < 1 &];
%t A088995 acc = Association[{}]; s = sol[[All, {1, 3}]]; For[i = 1,
%t A088995  i < Length[s], i++,
%t A088995  If[Lookup[acc, s[[i, 2]], 0] == 0,
%t A088995   acc[s[[i, 2]]] = s[[i, 1]]]]; final =
%t A088995  Rest[Sort[Normal[acc]]] /. Rule -> List;
%t A088995 bcc = Association[{}]; For[i = Max[Keys[acc]], i >= Min[Keys[acc]], i--,
%t A088995   j = i; While[Lookup[acc, j, 0] == 0 && j < Max[Keys[acc]], j++];
%t A088995  bcc[i] = acc[j]; j = i; While[bcc[j] >= bcc[j + 1], j++];
%t A088995  bcc[i] = Min[bcc[i], bcc[j]]]; bb =
%t A088995  Rest[Sort[Normal[Reverse[bcc]]]] /. Rule -> List (* _Xianwen Wang_, Jun 02 2023 *)
%o A088995 (Python) # NOTE: Although sympy's frac() may give incorrect results in some cases, care has been taken to ensure there should be no issue here. - _M. F. Hasler_, Mar 26 2025
%o A088995 from sympy import S, sqrt, log, frac
%o A088995 def A088995(n):
%o A088995     T = 10**n//sqrt(10); prec = (n+9)/.4; cf = 'continued_fraction'
%o A088995     L2, L5, a, b = (frac(log(x,10).n(prec)) for x in (2, 5, T, T+1))
%o A088995     L = []; test = lambda k: a < frac(k*L2) < b > frac(k*L5) > a
%o A088995     for K in S(f"{cf}_convergents({cf}_iterator(log(5/2,10)))"):
%o A088995         if test(k := K.q):    # = K.denominator but K.denominator() in old versions
%o A088995             for step in L[::-1]:
%o A088995               while test(k - step): k -= step
%o A088995             return k
%o A088995         if k > 99: L.append(k) # _M. F. Hasler_, Mar 22 2025, edited Mar 26 2025
%o A088995 print(first30 := [A088995(n) for n in range(1,30)]) # _M. F. Hasler_, Mar 18 2025, edited Mar 24 2025, Mar 28 2025
%o A088995 (PARI) apply( {A088995(n) = localprec(max(n/.4,38)); my(L1=log(10), L2=log(2)/L1, L5=1-L2, c=contfrac(L5-L2), T=sqrtint(10^(2*n-1)), a=log(T)/L1%1, b=log(T+1)/L1%1, d(x)=a<x && x<b, t(k)=d(k*L2%1) && d(k*L5%1), cv=contfracpnqn(c,#c)[2,]); for(i=1,#cv, t(c=cv[i]) && while(i-->3, while(t(c-cv[i]), c-=cv[i]))+return(c))}, [1..15]) \\ - _M. F. Hasler_, Mar 22 2025
%Y A088995 Cf. A088935, A010467, A359698, A073733.
%K A088995 base,nonn
%O A088995 1,1
%A A088995 _Lekraj Beedassy_, Dec 01 2003
%E A088995 Edited by _Robert G. Wilson v_, Dec 02 2003
%E A088995 More terms from J. Mulder (jasper.mulder(AT)planet.nl), Feb 03 2010
%E A088995 a(6) and a(7) corrected by _Keith F. Lynch_, May 25 2023
%E A088995 a(11), a(13)-a(15), a(17) corrected by _Zhao Hui Du_, Jun 07 2023