login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #8 Jun 26 2018 19:14:41

%S 1,4,12,10,20,32,30,68,49,73,82,93,125,103,109,131,146,119,161,113,

%T 172,163,191,197,199,240,232,243,210,217,288,317,292,289,321,333,319,

%U 327,276,374,358,397,354,357,373,452,428,489,391,516,470

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

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

%t With[{pwrs=7^Range[600]},Log[7,#]&/@Table[SelectFirst[pwrs, DigitCount[ #,10,2] == n&], {n,0,50}]] (* The program uses the SelectFirst function from Mathematica version 10 *) (* _Harvey P. Dale_, Aug 25 2015 *)

%K base,nonn

%O 0,2

%A _Robert G. Wilson v_, Aug 10 2001

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