login
Smallest k such that 4^k has exactly n 0's in its decimal representation.
11

%I #31 Jun 19 2018 05:49:10

%S 0,5,21,35,47,44,50,51,103,99,121,125,126,175,166,131,185,153,184,223,

%T 272,232,248,336,233,306,315,384,314,327,333,373,393,399,454,457,504,

%U 453,484,506,621,494,510,639,522,557,560,559,716,609,629

%N Smallest k such that 4^k has exactly n 0's in its decimal representation.

%H Harvey P. Dale, <a href="/A063575/b063575.txt">Table of n, a(n) for n = 0..1000</a> (first 150 terms from Harry J. Smith; a(0) modified by M. F. Hasler).

%t a = {}; Do[k = 0; While[ Count[ IntegerDigits[4^k], 0] != n, k++ ]; a = Append[a, k], {n, 0, 50} ]; a

%t Module[{nn=750,p4},p4=Table[{n,DigitCount[4^n,10,0]},{n,nn}];Transpose[ Table[ SelectFirst[p4,#[[2]]==i&],{i,0,50}]][[1]]] (* The program uses the SelectFirst function from Mathematica version 10 *) (* _Harvey P. Dale_, May 20 2016 *)

%o (PARI) Count(x, d)= { local(c,f); c=0; while (x>9, f=x-10*(x\10); if (f==d, c++); x\=10); if (x==d, c++); return(c) } { for (n=0, 150, a=0; while (Count(4^a, 0) != n, a++); write("b063575.txt", n, " ", a) ) } \\ _Harry J. Smith_, Aug 26 2009

%o (PARI) A063575(n)=for(k=n,oo,#select(d->!d,digits(4^k))==n&&return(k)) \\ _M. F. Hasler_, Jun 14 2018

%Y Cf. A031146 (analog for 2^k), A063555 (for 3^k), A063585 (for 5^k), A063596 (for 6^k), A063606 (for 7^k), A063616 (for 8^k).

%K base,nonn

%O 0,2

%A _Robert G. Wilson v_, Aug 10 2001

%E a(0) changed to 0 as in A031146, A063555, ... by _M. F. Hasler_, Jun 14 2018