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-3 of 3 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

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

A032524 Arrange digits of primes in ascending order (omitting any that contain 0's), sort list, remove duplicates.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 14, 16, 17, 19, 23, 29, 34, 35, 37, 38, 47, 59, 67, 79, 89, 112, 113, 115, 118, 119, 124, 125, 127, 128, 133, 134, 136, 137, 139, 145, 146, 149, 157, 166, 167, 169, 179, 188, 199, 223, 227, 229, 233, 235, 236, 238, 239, 257, 269, 277, 278, 289, 299, 334, 335, 337, 338, 344, 346
Offset: 1

Views

Author

Keywords

Examples

			From _Michael De Vlieger_, Jul 14 2015: (Start)
16 is a term because it is the result of sorting the digits of prime 61 in ascending order, and 61 contains no zeros.
49 is not a term since neither 49 nor 94 are prime, and the prime 409 contains a zero.
133 is a term because while 133 itself is composite, both 313 and 331 are prime and contain no zeros. (End)
		

Crossrefs

Programs

  • Mathematica
    Sort@ DeleteDuplicates[FromDigits@ Sort@ IntegerDigits@ # & /@ Select[Prime@ Range@ PrimePi[10^3], Last@ DigitCount@ # == 0 &]] (* Michael De Vlieger, Jul 14 2015 *)

Extensions

More terms from Erich Friedman
Corrected and extended by Michael De Vlieger, Jul 14 2015
Showing 1-3 of 3 results.