OFFSET
1,1
COMMENTS
From Robert Israel, Sep 06 2018: (Start)
"Multiple ways" here means more than one nontrivial permutation other than the identity permutation, i.e., there are at least 3 different primes formed by permuting digits of this prime.
Leading 0's are allowed in the permutations. (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
131 belongs to this sequence as there are two nontrivial permutations of its digits which yield other primes, namely 113 and 311.
137 also belongs to this sequence. Even though 371, 713 and 731 are composite, 173 and 317 are prime, satisfying the requirement.
139 does not belong in this sequence. Although 193 is prime, 319, 391, 913 and 931 are all composite.
MAPLE
filter:= proc(n) local L, Lp, t, i, m, x;
if not isprime(n) then return false fi;
L:= convert(n, base, 10);
m:= nops(L);
Lp:= combinat:-permute(L);
t:= 1;
for i from 1 to nops(Lp) do
if Lp[i]=L then next fi;
x:= add(Lp[i][j]*10^(j-1), j=1..m);
if isprime(x) then
t:= t+1;
if t = 3 then return true fi;
fi
od;
false
end proc:
select(filter, [seq(i, i=11..2000, 2)]); # Robert Israel, Sep 06 2018
MATHEMATICA
Select[Prime[Range[200]], Count[PrimeQ[Map[FromDigits, Permutations[IntegerDigits[#]]]], True] > 2 &] (* Alonso del Arte, Aug 24 2018 *)
Select[Prime[Range[200]], Count[FromDigits/@Rest[Permutations[IntegerDigits[#]]], _?PrimeQ]>1&] (* Harvey P. Dale, Sep 25 2024 *)
PROG
(Python)
from itertools import *
nmax=1000
def is_prime(num):
if num == 0 or num == 1: return(0)
for k in range(2, num):
if (num % k) == 0:
return(0)
return(1)
ris = ""
for i in range(nmax):
f=0
lf=[]
if is_prime(i):
for p in permutations(str(i), len(str(i))):
k=int(''.join(p))
if k!=i and is_prime(k):
if k not in lf:
f+=1
lf.append(k)
if f>1:
ris = ris+str(i)+", "
break
print(ris)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Pierandrea Formusa, Aug 23 2018
EXTENSIONS
More terms from Giovanni Resta, Sep 03 2018
STATUS
approved