login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A318295 Prime numbers such that there are multiple permutations of their digits which are still prime. 1
103, 107, 113, 131, 137, 149, 157, 163, 167, 173, 179, 197, 199, 307, 311, 317, 337, 359, 373, 379, 389, 397, 419, 491, 571, 593, 613, 617, 631, 701, 709, 719, 733, 739, 751, 761, 839, 907, 919, 937, 941, 953, 971, 983, 991, 1009, 1013, 1019, 1021, 1031, 1033 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

From Robert Israel, Sep 06 2018: (Start)

"Multiple" 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 more than one permutation of his digits which are still prime, 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 *)

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

Subsequence of A055387.

Sequence in context: A167841 A213311 A161402 * A165294 A046076 A178527

Adjacent sequences:  A318292 A318293 A318294 * A318296 A318297 A318298

KEYWORD

nonn,base

AUTHOR

Pierandrea Formusa, Aug 23 2018

EXTENSIONS

More terms from Giovanni Resta, Sep 03 2018

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 5 00:40 EDT 2020. Contains 335457 sequences. (Running on oeis4.)