OFFSET
1,2
COMMENTS
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
EXAMPLE
3^11 = 177147 contains 3 of the same digit (7). Since 11 is the smallest power of 3 to do this, a(3) = 11.
MAPLE
N:= 1000: # to get a(1) to a(m-1) where a(m) is the first > N
f:= proc(k)
local L;
L:= convert(3^k, base, 10);
max(seq(numboccur(i, L), i=0..9));
end proc:
for k from 1 to N do
v:= f(k);
if not assigned(A[v]) then A[v]:= k fi;
od:
for m from 1 while assigned(A[m]) do od:
seq(A[i], i=1..m-1); # Robert Israel, Feb 19 2015
MATHEMATICA
lnk[n_]:=Module[{k=1}, While[Count[DigitCount[3^k], n]<1, k++]; k]; Array[ lnk, 60] (* Harvey P. Dale, Feb 19 2015 *)
PROG
(Python)
def b():
..n = 1
..k = 1
..while k < 50000:
....st = str(3**k)
....if len(st) >= n:
......for a in range(10):
........count = 0
........for i in range(len(st)):
..........if st[i] == str(a):
............count += 1
........if count == n:
..........print(k, end=', ')
..........n += 1
..........k = 0
..........break
......k += 1
....else:
......k += 1
b()
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jun 16 2014
STATUS
approved