%I #10 Sep 07 2023 16:21:50
%S 1,4,11,17,32,42,85,55,84,100,115,120,162,128,202,111,214,267,260,316,
%T 321,319,295,307,298,331,384,404,451,454,490,488,449,521,528,511,575,
%U 617,584,604,590,628,663,619,668,807,776,812,718,788,856,796,956,960
%N Smallest k such that 3^k has exactly n 1's in its decimal representation.
%H Robert Israel, <a href="/A063556/b063556.txt">Table of n, a(n) for n = 0..1000</a>
%p f:= proc(n) numboccur(1,convert(3^n,base,10)) end proc:
%p N:= 100: # for a(0) .. a(N)
%p V:= Array(0..N): count:= 0:
%p for k from 1 while count <= N do
%p v:= f(k);
%p if v <= N and V[v] = 0 then V[v]:= k; count:= count+1; fi
%p od:
%p convert(V,list); # _Robert Israel_, Sep 07 2023
%t a = {}; Do[k = 1; While[ Count[ IntegerDigits[3^k], 1] != n, k++ ]; a = Append[a, k], {n, 0, 50} ]; a
%K base,nonn
%O 0,2
%A _Robert G. Wilson v_, Aug 10 2001
%E Name corrected by _Jon E. Schoenfield_, Jun 26 2018