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
Some terms occur more than once: e.g. a(191) = a(195) = 3383, since 3^3383 contains 191 digits equal to 3 and 195 digits equal to 0. - Robert Israel, Jan 25 2026
LINKS
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:= 100: # for a(1) .. a(N)count:= 0: V:= Vector(N):
f:= proc(k)
local L, i;
L:= convert(3^k, base, 10);
{seq(numboccur(i, L), i=0..9)} minus {0};
end proc:
for k from 1 while count < N do
for v in f(k) do if v <= N and V[v] = 0 then
V[v]:= k; count:= count+1;
fi od;
od:convert(V, list); # Robert Israel, Jan 25 2026
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
