OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 1007 because 1007 is composite, the five permutations 17, 71, 107, 701, and 7001 are all prime, and no other permutation of 1007 is prime.
MAPLE
filter:= proc(n) local d, Permutor, P, c, i;
if isprime(n) then return false fi;
d:= ilog10(n)+1;
Permutor:= Iterator:-Permute(convert(n, base, 10));
c:= 0;
for P in Permutor do
if isprime(add(P[i]*10^(i-1), i=1..d)) then
c:= c+1;
if c >= 6 then return false fi;
fi
od;
evalb(c=5)
end proc:
select(filter, [$10..2000]); # Robert Israel, Dec 30 2025
PROG
(PARI) upto(m)= my(r=List()); forcomposite(n=1, m, my(d=vecsort(digits(n)), c=0); forperm(d, p, (c+=isprime(fromdigits(p)))>5 && break); 5==c && listput(r, n)); Vec(r); \\ Ruud H.G. van Tol, Jan 02 2026
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Gil Broussard, Jul 30 2009
EXTENSIONS
Checked by Zak Seidov, Jul 01 2009
STATUS
approved
