OFFSET
1,1
COMMENTS
The new prime is necessarily different from the original prime (so 11, for example) is not a term. - N. J. A. Sloane, Jan 22 2023
Permutations producing leading zeros are allowed: thus 101 is in the sequence because a nontrivial permutation of its digits is 011. - Robert Israel, Aug 13 2019
It seems reasonable to expect that the proportion of n-digit primes that are in this sequence approaches 1 as n increases. - Peter Munn, Sep 13 2022
REFERENCES
H.-E. Richert, On permutation prime numbers, Norsk. Mat. Tidsskr. 33 (1951), p. 50-53.
Joe Roberts, Lure of the Integers, Math. Assoc. of Amer., 1992, p. 293.
James J. Tattersall, Elementary Number Theory in Nine Chapters, Second Edition, Cambridge University Press, p. 121.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
13 is a term since a nontrivial permutation of its digits yields 31, which is also a prime.
MAPLE
dmax:=3: # for all terms of up to dmax digits
Res:= {}:
p:= 1:
do
p:= nextprime(p);
if p > 10^dmax then break fi;
L:= sort(convert(p, base, 10), `>`);
m:= add(L[i]*10^(i-1), i=1..nops(L));
if assigned(A[m]) then
if ilog10(A[m])=ilog10(p) then
Res:= Res union {A[m], p}
else Res:= Res union {p}
fi
else A[m]:= p
fi
od:
sort(convert(Res, list)); # Robert Israel, Aug 13 2019
MATHEMATICA
t={}; Do[p = Prime[n]; list1 = Permutations[IntegerDigits[p]]; If[Length[ Select[Table[FromDigits[n], {n, list1}], PrimeQ]] > 1, AppendTo[t, p]], {n, 84}]; t
PROG
(Python)
from sympy import isprime
from itertools import permutations
def ok(n):
if not isprime(n): return False
perms = (int("".join(p)) for p in permutations(str(n)))
return any(isprime(t) for t in perms if t != n)
print([k for k in range(500) if ok(k)]) # Michael S. Branicky, Sep 14 2022
(PARI) is(p) = if(isprime(p), my(d=vecsort(digits(p))); d==vector(#d, x, 1)&&return(1); forperm(d, e, my(c = fromdigits(Vec(e))); p!=c && isprime(c) && return(1))); \\ Ruud H.G. van Tol, Jan 22 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jayanta Basu, Apr 24 2013
EXTENSIONS
Edited by N. J. A. Sloane, Jan 22 2023
STATUS
approved