OFFSET
0,2
COMMENTS
From David A. Corneth, Nov 07 2019: (Start)
Let z(n) be the largest number of consecutive zeros in 5^n. Then we have |z(n+1) - z(n)| <= 1. So we needn't check every k if it's in the sequence. (End)
LINKS
O. M. Cain, The Exceptional Selfcondensability of Powers of Five, arXiv:1910.13829 [math.HO], 2019.
EXAMPLE
5^1 = 5 is the first power of 5 that has no zero, so a(0) = 1.
5^8 = 390625 is the first power of 5 that has 1 zero, so a(1) = 8.
5^39 = 1818989403545856475830078125 is the first power of 5 that has 2 consecutive zeros, so a(2) = 39.
MATHEMATICA
Print[1]; zero = {}; Do[zero = zero <> "0"; k = 1; While[StringPosition[ToString[5^k], zero] == {}, k++]; Print[k]; , {n, 1, 10}] (* Vaclav Kotesovec, Nov 07 2019 *)
PROG
(PARI) isok(k, n) = {my(d = digits(5^k), pz = select(x->(x==0), d)); if (n<=1, return (#pz == n)); if (#pz < n, return (0)); my(c=0, ok=0, kc=0); for (i=1, #d, if (d[i] == 0, ok = 1; if (ok, c++), if (c > kc, kc=c); ok = 0; c = 0); ); kc == n; }
a(n) = my(k=1); while (!isok(k, n), k++); k;
(PARI) upto(n) = {my(p5 = 5, res = List()); for(i = 1, n, c = qconsecutivezeros(p5); for(j = #res, c, listput(res, i); print1(i", "); ); p5 *= 5 ); res }
qconsecutivezeros(n) = { my(d = digits(n), streak = 0, res = 0); for(i = 1, #d, if(d[i] == 0, streak++ , res = max(streak, res); streak = 0 ) ); res } \\ David A. Corneth, Nov 07 2019
CROSSREFS
KEYWORD
nonn,base,more,hard
AUTHOR
Michel Marcus, Nov 07 2019
EXTENSIONS
a(9)-a(10) from David A. Corneth, Nov 07 2019
a(11) from Vaclav Kotesovec, Nov 08 2019
STATUS
approved