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.

A356196 Consider pairs of consecutive primes {p,q} such that p, q, q-p and q+p all with distinct digits. Sequence gives lesser primes p.

Original entry on oeis.org

2, 3, 5, 13, 17, 19, 23, 29, 31, 37, 41, 43, 59, 61, 67, 73, 79, 83, 89, 103, 107, 137, 157, 167, 173, 193, 239, 241, 251, 257, 263, 269, 281, 283, 359, 389, 397, 401, 419, 421, 457, 461, 463, 467, 487, 523, 601, 613, 617, 619, 641, 643, 683
Offset: 1

Views

Author

Zak Seidov, Oct 31 2022

Keywords

Comments

This sequence has 1843 terms, the last being 927368041.

Examples

			For last term: p = 927368041, q = 927368051, q-p = 10, q+p = 1854736092.
		

Crossrefs

Subsequence of A029743 (primes with distinct digits).

Programs

  • Python
    from sympy import isprime, nextprime
    from itertools import combinations, permutations
    def distinct(n): s = str(n); return len(s) == len(set(s))
    def afull():
        for d in range(1, 10):
            s = set()
            for p in permutations("0123456789", d):
                if p[0] == "0": continue
                p = int("".join(p))
                if not isprime(p): continue
                q = nextprime(p)
                if not all(distinct(t) for t in [q, q-p, q+p]): continue
                s.add(p)
            yield from sorted(s)
    print(list(afull())) # Michael S. Branicky, Nov 01 2022