OFFSET
1,1
COMMENTS
a(8996) has 1001 digits. - Michael S. Branicky, Mar 19 2024
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..8995
EXAMPLE
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.
PROG
(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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Mar 12 2002
EXTENSIONS
Corrected and extended by Ray Chandler, Jul 19 2003
a(46) and beyond from Michael S. Branicky, Mar 19 2024
STATUS
approved