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.
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
Examples
For last term: p = 927368041, q = 927368051, q-p = 10, q+p = 1854736092.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..1843
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
Comments