%I #17 Feb 20 2015 15:03:02
%S 1,8,11,29,32,47,34,33,90,98,112,136,128,172,111,168,146,211,241,218,
%T 220,290,278,298,323,355,329,316,344,446,427,395,410,528,481,443,498,
%U 523,574,540,531,538,618,549,694,669,733,717,788,707,740,734,831,743,857,850,864
%N Least number k such that 3^k contains exactly n identical digits.
%C It is permissible for 3^k to have more than one digit repeated n times. For example a(11)=112, and 3^112 has 11 digits equal to 3 and also 11 digits equal to 7. - _Harvey P. Dale_, Feb 19 2015
%H <a href="/index/De#decimal_expansion">Index entries for sequences related to decimal expansion of n</a>
%e 3^11 = 177147 contains 3 of the same digit (7). Since 11 is the smallest power of 3 to do this, a(3) = 11.
%p N:= 1000: # to get a(1) to a(m-1) where a(m) is the first > N
%p f:= proc(k)
%p local L;
%p L:= convert(3^k,base,10);
%p max(seq(numboccur(i,L),i=0..9));
%p end proc:
%p for k from 1 to N do
%p v:= f(k);
%p if not assigned(A[v]) then A[v]:= k fi;
%p od:
%p for m from 1 while assigned(A[m]) do od:
%p seq(A[i],i=1..m-1); # _Robert Israel_, Feb 19 2015
%t lnk[n_]:=Module[{k=1},While[Count[DigitCount[3^k],n]<1,k++];k]; Array[ lnk,60] (* _Harvey P. Dale_, Feb 19 2015 *)
%o (Python)
%o def b():
%o ..n = 1
%o ..k = 1
%o ..while k < 50000:
%o ....st = str(3**k)
%o ....if len(st) >= n:
%o ......for a in range(10):
%o ........count = 0
%o ........for i in range(len(st)):
%o ..........if st[i] == str(a):
%o ............count += 1
%o ........if count == n:
%o ..........print(k,end=', ')
%o ..........n += 1
%o ..........k = 0
%o ..........break
%o ......k += 1
%o ....else:
%o ......k += 1
%o b()
%Y Cf. A000244, A243972.
%K nonn,base
%O 1,2
%A _Derek Orr_, Jun 16 2014