login
Smallest k such that 2^k has exactly n 5's in its decimal representation.
9

%I #17 Jun 26 2018 05:02:54

%S 1,8,16,39,41,68,131,108,142,178,198,201,167,215,283,344,367,318,404,

%T 428,312,461,441,556,506,562,536,716,652,679,733,690,575,807,627,949,

%U 811,867,932,1035,1003,1088,893,1112,1193,1080,1127,1094,1016,1283

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

%H Harry J. Smith, <a href="/A063526/b063526.txt">Table of n, a(n) for n = 0..150</a>

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

%t Join[{1},Flatten[With[{pwrs=DigitCount[#,10,5]&/@(2^Range[0,1300])},Table[Position[pwrs,n,1,1],{n,50}]]]-1] (* _Harvey P. Dale_, Jan 28 2013 *)

%o (PARI) a(n)={my(k=1); while(n<>#select(d->d==5, digits(2^k)), k++); k} \\ _Harry J. Smith_, Aug 25 2009, _Andrew Howroyd_, Jun 26 2018

%Y Cf. A063115, A063426, A063429, A063430, A063540, A063552, A063553, A063554.

%K base,nonn

%O 0,2

%A _Robert G. Wilson v_, Aug 10 2001

%E Name corrected by _Jon E. Schoenfield_, Jun 25 2018