login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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)
A166681_list = list(islice(A166681_gen(), 20)) # Chai Wah Wu, Jan 17 2023
CROSSREFS
Sequence in context: A174056 A307894 A322472 * A109308 A263241 A246944
KEYWORD
nonn,base
AUTHOR
Pierre CAMI, Oct 18 2009
EXTENSIONS
Definition clarified, sequence extended. - R. J. Mathar, Oct 12 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 05:39 EDT 2024. Contains 371235 sequences. (Running on oeis4.)