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

%I #7 Jun 26 2018 19:21:55

%S 1,3,19,24,56,49,60,78,87,100,108,143,169,145,210,160,183,193,260,270,

%T 312,321,325,353,348,419,388,409,316,403,465,502,483,489,561,533,443,

%U 565,691,646,677,552,721,711,687,700,791,813,768,867,806

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

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

%t With[{pwr3=3^Range[1000]},IntegerExponent[#,3]&/@Flatten[Table[ Select[ pwr3, DigitCount[#,10,2]==n&,1],{n,0,50}]]] (* _Harvey P. Dale_, Sep 09 2012 *)

%K base,nonn

%O 0,2

%A _Robert G. Wilson v_, Aug 10 2001

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