

A329172


a(n) is the least positive exponent k such that the decimal expansion of 5^k contains n consecutive zeros.


1



1, 8, 39, 67, 228, 1194, 3375, 10052, 19699, 26563, 26566, 922553
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

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



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



EXTENSIONS



STATUS

approved



