|
|
A225035
|
|
Primes such that there is a nontrivial rearrangement of the digits which is a prime.
|
|
4
|
|
|
13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 359, 367, 373, 379, 389, 397, 401, 419, 421
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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:
|
|
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)
(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
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|