login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #14 Jun 26 2018 05:03:20

%S 1,12,34,32,83,53,92,139,93,172,173,244,254,335,342,332,333,415,356,

%T 434,506,473,477,476,517,532,596,643,662,673,731,729,603,735,850,793,

%U 792,966,959,961,1043,1129,1131,1159,1153,1077,1157,1241,1078,1328

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

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

%t n9[n_]:=Module[{k=1},While[DigitCount[2^k,10,9]!=n,k++];k]; Array[n9,50,0] (* _Harvey P. Dale_, Dec 17 2011 *)

%t With[{t=DigitCount[#,10,9]&/@(2^Range[1500])},Flatten[Table[Position[t,n,{1},1],{n,0,50}]]] (* _Harvey P. Dale_, Mar 17 2016 *)

%o (PARI) a(n)={my(k=1); while(n<>#select(d->d==9, digits(2^k)), k++); k} \\ _Andrew Howroyd_, Jun 26 2018

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

%K base,nonn

%O 0,2

%A _Robert G. Wilson v_, Aug 10 2001

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