OFFSET
1,1
COMMENTS
The least digit of a term must be a prime, and can occur only once in the term. - Robert Israel, Dec 08 2024
LINKS
Robert Israel, Table of n, a(n) for n = 1..1250 (full sequence)
EXAMPLE
9929 is a member because 9929, 929, 29 and 2 are all prime.
MAPLE
insert:= proc(L, d, pos)
local Lp, i;
Lp:= [op(L[1..pos]), d, op(L[pos+1..-1])];
add(Lp[i]*10^(i-1), i=1..nops(Lp))
end proc:
extend:= proc(n) local L, dmax, jmax, d, i, S;
L:= convert(n, base, 10);
dmax:= max(L);
for jmax from nops(L) by -1 do if L[jmax] = dmax then break fi od;
S:= [seq(seq(insert(L, d, i), d=dmax+1..9), i=0..nops(L)),
seq(insert(L, dmax, i), i=jmax..nops(L))];
op(sort(select(isprime, S)))
end proc:
A[1]:= [2, 3, 5, 7]:
dmax:= 5: # for terms of up to dmax digits
for i from 2 to dmax do
A[i]:= sort(map(extend, A[i-1]));
od:
map(op, [seq(A[i], i=2..dmax)]); # Robert Israel, Dec 09 2024
CROSSREFS
KEYWORD
base,nonn,fini,full
AUTHOR
Zak Seidov, Jan 27 2005
EXTENSIONS
Name clarified by Robert Israel, Dec 08 2024
STATUS
approved