OFFSET
0,1
LINKS
Robert Israel, Table of n, a(n) for n = 0..1009 (rows 0 to 100)
EXAMPLE
T(4,1) = 10111 because 10111 is the first prime with four 1's.
Array starts
2 2 3 2 2 2 2 2 2 2
101 13 2 3 41 5 61 7 83 19
1009 11 223 233 443 557 661 277 881 199
10007 1117 2221 2333 4441 5557 6661 1777 8887 1999
100003 10111 22229 23333 44449 155557 166667 47777 88883 49999
1000003 101111 1222229 313333 444443 555557 666667 727777 888887 199999
MAPLE
F:= proc(v, x) local d, y, z, L, S, SS, Cands, t, i, k;
for d from v do
Cands:= NULL;
if x = 0 then SS:= combinat:-choose([$2..d-1], v)
elif member(x, [1, 3, 7, 9]) then SS:= combinat:-choose(d, v)
else SS:= combinat:-choose([$2..d], v)
fi;
for S in SS do
for y from 9^(d-v+1) to 9^(d-v+1)+9^(d-v)-1 do
L:= convert(y, base, 9)[1..d-v+1];
L:= map(proc(s) if s < x then s else s+1 fi end proc, L);
i:= 1;
t:= 0:
for k from 1 to d do
if member(k, S) then t:= t + x*10^(k-1)
else t:= t + L[i]*10^(k-1); i:= i+1;
fi;
od;
Cands:= Cands, t
od od;
Cands:= sort([Cands]);
for t in Cands do if isprime(t) then return t fi od;
od
end proc:
F(0, 0):= 2: F(1, 2):= 2: F(1, 5):= 5:
for i from 0 to 10 do
seq(F(i, x), x=0..9)
od;
MATHEMATICA
T[n_, k_]:=Module[{p=2}, While[Count[IntegerDigits[p], k]!=n, p=NextPrime[p]]; p]; Table[T[n, k], {n, 0, 5}, {k, 0, 9}]//Flatten (* Stefano Spezia, Aug 27 2024 *)
CROSSREFS
KEYWORD
nonn,tabf,base
AUTHOR
Robert Israel, Aug 27 2024
STATUS
approved