login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A068853
a(1) = 2; a(n+1) is the smallest prime > a(n) which differs from it in every digit.
5
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,1
COMMENTS
a(8996) has 1001 digits. - Michael S. Branicky, Mar 19 2024
LINKS
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
Cf. A068863.
Sequence in context: A019344 A229291 A057459 * A328076 A236400 A288371
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