OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 170 because 170 is composite, the four permutations 17, 71, 107, and 701 are all prime, and no other permutation of 170 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 >= 5 then return false fi;
fi
od;
evalb(c=4)
end proc:
select(filter, [$10..2000]); # Robert Israel, Aug 10 2020
MATHEMATICA
Select[Range[1300], CompositeQ[#]&&Count[FromDigits/@Permutations[ IntegerDigits[ #]], _?PrimeQ]==4&] (* Harvey P. Dale, Oct 26 2015 *)
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Gil Broussard, Jul 30 2009
STATUS
approved