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

%I #8 Jan 21 2023 12:44:39

%S 1,4,9,25,36,54,45,56,68,106,87,98,100,203,140,154,160,174,165,263,

%T 246,243,157,234,276,280,338,308,343,371,335,299,427,394,497,475,473,

%U 405,524,467,577,485,586,509,492,644,464,677,563,616,582

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

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

%t With[{nk2=Table[{k,DigitCount[4^k,10,2]},{k,700}]},Table[SelectFirst[nk2,#[[2]] == n&],{n,0,50}]][[All,1]] (* _Harvey P. Dale_, Jan 21 2023 *)

%K base,nonn

%O 0,2

%A _Robert G. Wilson v_, Aug 10 2001

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