A068853 a(1) = 2; a(n+1) is the smallest prime > a(n) which differs from it in every digit.
2, 3, 5, 7, 11, 23, 31, 43, 59, 61, 73, 89, 97, 101, 223, 307, 419, 503, 617, 701, 823, 907, 1013, 2129, 3001, 4127, 5003, 6121, 7013, 8101, 9013, 10139, 21001, 30113, 41039, 50101, 61027, 70111, 81023, 90107, 101021, 210109, 301013, 410141, 501013, 610157, 701009
Offset: 1
Examples
223 is a member and the next few primes are 227, 229, ... 283, 297, 307. 307 is the smallest one which differs from 223 in all corresponding positions.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..8995
Crossrefs
Cf. A068863.
Programs
-
Python
from sympy import isprime from itertools import count, islice, product def diffgen(n): # generator of numbers >n sharing no digits with n s = str(n) P = [list(str(d) for d in range(10) if str(d) != si) for si in s] if s[0] < '9': f = [d for d in P[0] if d > s[0]] for t in product(*([f]+P[1:])): yield int("".join(t)) for e in count(1): for t in product("123456789", *(["0123456789"]*(e-1) + P)): yield int("".join(t)) def agen(): # generator of terms an = 2 while True: yield an an = next(k for k in diffgen(an) if isprime(k)) print(list(islice(agen(), 47))) # Michael S. Branicky, Mar 19 2024
Extensions
Corrected and extended by Ray Chandler, Jul 19 2003
a(46) and beyond from Michael S. Branicky, Mar 19 2024
Comments