%I #38 Nov 08 2019 02:10:11
%S 1,8,39,67,228,1194,3375,10052,19699,26563,26566,922553
%N a(n) is the least positive exponent k such that the decimal expansion of 5^k contains n consecutive zeros.
%C From _David A. Corneth_, Nov 07 2019: (Start)
%C 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)
%H O. M. Cain, <a href="https://arxiv.org/abs/1910.13829">The Exceptional Selfcondensability of Powers of Five</a>, arXiv:1910.13829 [math.HO], 2019.
%e 5^1 = 5 is the first power of 5 that has no zero, so a(0) = 1.
%e 5^8 = 390625 is the first power of 5 that has 1 zero, so a(1) = 8.
%e 5^39 = 1818989403545856475830078125 is the first power of 5 that has 2 consecutive zeros, so a(2) = 39.
%t 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 *)
%o (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;}
%o a(n) = my(k=1); while (!isok(k, n), k++); k;
%o (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 }
%o 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
%Y Cf. A000351 (powers of 5), A006889, A052968 (another family of exponents), A195269, A329174.
%K nonn,base,more,hard
%O 0,2
%A _Michel Marcus_, Nov 07 2019
%E a(9)-a(10) from _David A. Corneth_, Nov 07 2019
%E a(11) from _Vaclav Kotesovec_, Nov 08 2019
|