cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-5 of 5 results.

A055387 2, 3, 5, 7, together with primes such that there is a nontrivial rearrangement of the digits which is a prime.

Original entry on oeis.org

2, 3, 5, 7, 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
Offset: 1

Views

Author

Asher Auel, May 05 2000

Keywords

Comments

Union of {2, 3, 5, 7} and A225035.

Crossrefs

Extensions

Edited by N. J. A. Sloane, Jan 22 2023

A359136 Primes such that there is a nontrivial permutation which when applied to the digits produces a prime (Version 1).

Original entry on oeis.org

11, 13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 419, 421
Offset: 1

Views

Author

Keywords

Comments

A prime p with decimal expansion p = d_1 d_2 ... d_m is in this sequence iff there is a non-identity permutation pi in S_m such that q = d_pi(1) d_pi(2) ... d_pi(m) is also a prime. The prime q may or may not be equal to p. Leading zeros are permitted in q.
One must be careful when using the phrase "nontrivial permutation of the digits". When the first and third digits of 101 are exchanged, this is applying the nontrivial permutation (1,3) in S_3 to the digits, leaving the number itself unchanged. One should specify whether it is the permutation that is nontrivial, or its action on what is being permuted. In this sequence and A359137, we mean that the permutation itself is nontrivial.
There are only 34 primes not in this sequence, the greatest of which is 5849. - Andrew Howroyd, Jan 22 2023

Crossrefs

Many OEIS entries are subsequences (possibly after omitting 2, 3, 5, and 7): A007500, A055387, A061461, A069706, A090933, A225035.

Programs

  • PARI
    isok(n)={my(v=vecsort(digits(n))); if(#Set(v)<#v, 1, forperm(v, u, my(t=fromdigits(Vec(u))); if(isprime(t) && t<>n, return(1))); 0)} \\ Andrew Howroyd, Jan 22 2023
    
  • Python
    from sympy import isprime
    from itertools import permutations as P
    def ok(n):
        if not isprime(n): return False
        if len(s:=str(n)) > len(set(s)): return True
        return any(isprime(t) for t in (int("".join(p)) for p in P(s)) if t!=n)
    print([k for k in range(422) if ok(k)]) # Michael S. Branicky, Jan 23 2023

Extensions

More than the usual number of terms are shown in order to distinguish this from neighboring sequences.
Incorrect terms removed by Andrew Howroyd, Jan 22 2023

A225035 Primes such that there is a nontrivial rearrangement of the digits which is a prime.

Original entry on oeis.org

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
Offset: 1

Views

Author

Jayanta Basu, Apr 24 2013

Keywords

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

Examples

			13 is a term since a nontrivial permutation of its digits yields 31, which is also a prime.
		

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.

Crossrefs

See A055387, A359136-A359139 for other versions.

Programs

  • 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:
    sort(convert(Res,list)); # Robert Israel, Aug 13 2019
  • 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
  • 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
  • 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)
    print([k for k in range(500) if ok(k)]) # Michael S. Branicky, Sep 14 2022
    

Extensions

Edited by N. J. A. Sloane, Jan 22 2023

A359137 Primes such that there is a nontrivial permutation which when applied to the digits produces a prime (Version 2).

Original entry on oeis.org

11, 13, 17, 31, 37, 71, 73, 79, 97, 101, 107, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 277, 281, 283, 293, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 419, 421
Offset: 1

Views

Author

Keywords

Comments

A prime p with decimal expansion p = d_1 d_2 ... d_m is in this sequence iff there is a non-identity permutation pi in S_m such that q = d_pi(1) d_pi(2) ... d_pi(m) is also a prime. The prime q may or may not be equal to p. Leading zeros are not permitted in q.
One must be careful when using the phrase "nontrivial permutation of the digits". When the first and third digits of 101 are exchanged, this is applying the nontrivial permutation (1,3) in S_3 to the digits, leaving the number itself unchanged. One should specify whether it is the permutation that is nontrivial, or its action on what is being permuted. In this sequence and A359136, we mean that the permutation itself is nontrivial.
There are only 53 primes not in this sequence, the greatest of which is 8059. - Andrew Howroyd, Jan 22 2023

Crossrefs

Programs

  • PARI
    isok(n)={my(v=vecsort(digits(n))); if(#Set(v)<#v, 1, forperm(v, u, if(u[1]<>0, my(t=fromdigits(Vec(u))); if(isprime(t) && t<>n, return(1)))); 0)} \\ Andrew Howroyd, Jan 22 2023
    
  • Python
    from sympy import isprime
    from itertools import permutations as P
    def ok(n):
        if not isprime(n): return False
        if len(s:=str(n)) > len(set(s)): return True
        return any(isprime(t) for t in (int("".join(p)) for p in P(s) if p[0]!="0") if t!=n)
    print([k for k in range(422) if ok(k)]) # Michael S. Branicky, Jan 23 2023

Extensions

More than the usual number of terms are shown in order to distinguish this from other similar sequences.
Incorrect terms removed by Andrew Howroyd, Jan 22 2023

A359138 A359136 together with 2, 3, 5, 7.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 419, 421
Offset: 1

Views

Author

Keywords

Comments

By including the "by convention" terms 2, 3, 5, and 7, many sequences such as A007500 are now subsequences.

Crossrefs

See also A007500.

Extensions

More than the usual number of terms are shown in order to distinguish this from other similar sequences.
Incorrect terms removed by Andrew Howroyd, Jan 22 2023
Showing 1-5 of 5 results.