|
|
A166681
|
|
Primes p which have at least one prime anagram larger than p.
|
|
3
|
|
|
13, 17, 37, 79, 107, 113, 127, 131, 137, 139, 149, 157, 163, 167, 173, 179, 181, 191, 197, 199, 239, 241, 251, 277, 281, 283, 313, 337, 347, 349, 359, 367, 373, 379, 389, 397, 419, 457, 461, 463, 467, 479, 491, 563, 569, 571, 577, 587, 593, 613
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Primes like 113, 137, 149, 157 etc have more than one such larger anagram, but are only listed once.
|
|
LINKS
|
|
|
EXAMPLE
|
13 is the first with 31 as prime anagram.
17 is the second with 71 as prime anagram.
31 has one anagram 13 but this is not >31 so 31 is not in the sequence.
|
|
MAPLE
|
filter:= proc(p) local L, Lp, q, i;
if not isprime(p) then return false fi;
L:= convert(p, base, 10);
for Lp in combinat:-permute(L) do
q:= add(Lp[i]*10^(i-1), i=1..nops(L));
if q > p and isprime(q) then return true fi
od;
false
end proc:
select(filter, [seq(i, i=13..1000, 2)]); # Robert Israel, Jan 18 2023
|
|
MATHEMATICA
|
paQ[n_]:=Length[Select[FromDigits/@Permutations[IntegerDigits[n]], #>n && PrimeQ[#]&]]>0; Select[Prime[Range[200]], paQ] (* Harvey P. Dale, Sep 23 2013 *)
|
|
PROG
|
(Python)
from itertools import islice
from sympy.utilities.iterables import multiset_permutations
from sympy import isprime, nextprime
def A166681_gen(): # generator of terms
p = 13
while True:
for q in multiset_permutations(str(p)):
if (r:=int(''.join(q)))>p and isprime(r):
yield p
break
p = nextprime(p)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Definition clarified, sequence extended. - R. J. Mathar, Oct 12 2012
|
|
STATUS
|
approved
|
|
|
|