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

%I #8 Sep 06 2022 14:02:00

%S 1,3,8,14,19,28,39,38,51,76,69,65,95,56,107,115,130,124,180,171,168,

%T 160,186,193,199,169,207,216,200,223,192,282,285,240,278,322,298,317,

%U 331,309,315,343,311,416,378,430,403,402,454,441,376

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

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

%t Join[{1,3},Module[{nn=500,p8},p8=Table[{n,8^n},{n,0,nn}];Table[SelectFirst[ p8,DigitCount[#[[2]],10,1]==x&],{x,2,50}]][[All,1]]] (* _Harvey P. Dale_, Sep 06 2022 *)

%K base,nonn

%O 0,2

%A _Robert G. Wilson v_, Aug 10 2001

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