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

A375965 Primes which can be turned into a different prime by exchanging two consecutive digits.

Original entry on oeis.org

13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 131, 137, 139, 149, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 349, 373, 379, 389, 397, 401, 419, 421, 439, 457, 461, 463, 467, 491, 503
Offset: 1

Views

Author

Matthew House, Sep 04 2024

Keywords

Comments

Heuristically, both this sequence and its complement should have positive density within the primes. Empirically, n/pi(a(n)) approaches ~0.75 for large n. But is this sequence even infinite?
Dickson's conjecture implies it is infinite, e.g. it implies that there are infinitely many primes ending in 13 for which changing the last two digits to 31 produces a prime. - Robert Israel, Sep 04 2024

Examples

			2, 3, 5, and 7 are excluded, since they have no two digits to exchange.
11 is excluded, since it yields only itself.
13 and 17 are included, since they yield the primes 31 and 71.
19, 23, and 29 are excluded, since they yield the composite numbers 91, 32, and 92.
		

Crossrefs

Subsequence of A225035.

Programs

  • Maple
    filter:= proc(n) local L,d,i;
      if not isprime(n) then return false fi;
      L:= convert(n,base,10); d:= nops(L);
      for i from 1 to d-1 do
          if L[i] <> L[i+1] and isprime(n + (L[i]-L[i+1])*(10^i-10^(i-1))) then return true fi
      od;
      false
    end proc:
    select(filter, [seq(i,i=11 .. 1---,2)]); # Robert Israel, Sep 04 2024
  • Mathematica
    Select[Prime[Range[100]], With[{digits = IntegerDigits[#]}, AnyTrue[Complement[FromDigits[Permute[digits, Cycles[{{#, # + 1}}]]] & /@ Range[Length[digits] - 1], {#}], PrimeQ]] &]
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        s = str(n)
        for i in range(len(s)-1):
            t = int(s[:i]+s[i+1]+s[i]+s[i+2:])
            if t != n and isprime(t): return True
        return False
    print([k for k in range(504) if ok(k)]) # Michael S. Branicky, Sep 04 2024

A359978 Prime numbers whose decimal representation can be split into two nonempty parts without leading 0, say x and y (in that order), and such that the concatenation of y and x yields a different prime number.

Original entry on oeis.org

13, 17, 31, 37, 71, 73, 79, 97, 113, 127, 131, 149, 157, 163, 173, 181, 191, 197, 199, 271, 277, 311, 313, 317, 331, 337, 359, 367, 373, 379, 397, 419, 479, 491, 571, 577, 593, 617, 631, 673, 719, 727, 733, 739, 757, 761, 787, 797, 811, 839, 877, 911, 919, 937
Offset: 1

Views

Author

Rémy Sigrist, Jan 20 2023

Keywords

Examples

			The first terms, alongside the corresponding other prime numbers, are:
  n   a(n)  Other prime numbers
  --  ----  -------------------
   1    13  {31}
   2    17  {71}
   3    31  {13}
   4    37  {73}
   5    71  {17}
   6    73  {37}
   7    79  {97}
   8    97  {79}
   9   113  {131, 311}
  10   127  {271}
  11   131  {113, 311}
  12   149  {491}
		

Crossrefs

Programs

  • PARI
    See Links section.

A376030 Primes which can be turned into a different prime by exchanging two digits. (Leading zeros are not allowed.)

Original entry on oeis.org

13, 17, 31, 37, 71, 73, 79, 97, 107, 113, 131, 137, 139, 149, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251, 277, 281, 283, 293, 311, 313, 317, 331, 337, 347, 349, 359, 373, 379, 389, 397, 419, 421, 439, 457, 461, 463, 467, 491, 521, 547, 563
Offset: 1

Views

Author

James S. DeArmon, Sep 06 2024

Keywords

Examples

			13 is the first term, since 31 is also prime.  113 is a term, since 131 is prime. 101 is not allowed as a term: 011 is prime, but has a leading zero.
		

Crossrefs

Subsequence of A225035.
Cf. A375965.

Programs

  • Python
    from sympy import isprime
    from itertools import combinations
    def ok(n):
        if not isprime(n): return False
        s = list(str(n))
        for i, j in combinations(range(len(s)), 2):
            sij = s[:]
            sij[i], sij[j] = sij[j], sij[i]
            if sij[0] != "0" and sij != s and isprime(int("".join(sij))):
                return True
        return False
    print([k for k in range(565) if ok(k)]) # Michael S. Branicky, Sep 07 2024

Extensions

Corrected and more terms from Michael S. Branicky, Sep 07 2024

A376213 Prime numbers wherein a triple exchange of 3 of the digits creates two prime numbers, neither of which has a leading zero digit.

Original entry on oeis.org

113, 131, 197, 199, 311, 337, 373, 719, 733, 919, 971, 991, 1013, 1019, 1031, 1091, 1123, 1163, 1181, 1193, 1213, 1231, 1237, 1279, 1297, 1307, 1319, 1321, 1327, 1399, 1439, 1487, 1499, 1543, 1549, 1571, 1613, 1621, 1637, 1733, 1747, 1759, 1777, 1811, 1831, 1913
Offset: 1

Views

Author

James S. DeArmon, Sep 15 2024

Keywords

Comments

A triple exchange is a permutation of 3 elements in which all 3 three items change position. (For the triple "ABC", that would be "BCA" and "CAB".)

Examples

			The first term is the prime 113, since 131 and 311 are also prime. Another term is 1013, since 1103 and 1301 are prime.
		

Crossrefs

Subsequence of A225035. Cf. A375965.

Programs

  • Python
    from sympy import isprime
    from itertools import combinations, permutations
    def ok(n):
        if n < 100 or not isprime(n): return False
        s = list(str(n))
        for i, j, k in combinations(range(len(s)), 3):
            pset, w, x = {n}, s[:], s[:]
            w[i], w[j], w[k] = w[j], w[k], w[i]
            x[i], x[j], x[k] = x[k], x[i], x[j]
            if w[0] != "0" and isprime(t:=int("".join(w))): pset.add(t)
            if x[0] != "0" and isprime(t:=int("".join(x))): pset.add(t)
            if len(pset) == 3: return True
        return False
    print([k for k in range(1920) if ok(k)]) # Michael S. Branicky, Sep 17 2024

Extensions

Terms corrected by Michael S. Branicky, Sep 17 2024
Showing 1-6 of 6 results.