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-2 of 2 results.

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-2 of 2 results.