A276512 a(n) = smallest integer not yet in the sequence with no digits in common with a(n-2); a(0)=0, a(1)=1.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 22, 20, 13, 14, 24, 23, 15, 16, 26, 25, 17, 18, 28, 27, 19, 30, 32, 12, 40, 33, 21, 29, 34, 31, 50, 42, 36, 35, 41, 44, 37, 38, 45, 46, 39, 51, 47, 43, 52, 55, 48, 49, 53, 56, 60, 70, 54, 58, 61, 62, 57, 59, 63, 64, 71, 72, 65, 66, 73, 74, 68, 69, 75
Offset: 0
Links
- Zak Seidov, Table of n, a(n) for n = 0..5000
Programs
-
Mathematica
s={0,1};Do[a=s[[-2]];n=2; While[MemberQ[s,n]||Intersection [IntegerDigits[a],IntegerDigits[n]]≠{}, n++];AppendTo[s,n],{100}];s
-
Python
from itertools import count, islice, product as P def only(s, D=1): # numbers with >= D digits only from s yield from (int("".join(p)) for d in count(D) for p in P(s, repeat=d)) def agen(): # generator of terms aset, an1, an, minan = {0, 1}, 0, 1, 2 yield from [0, 1] while True: an1, an, s = an, minan, set(str(an1)) use = "".join(c for c in "0123456789" if c not in s) for an in only(use, D=len(str(minan))): if an not in aset: break aset.add(an) yield an while minan in aset: minan += 1 print(list(islice(agen(), 75))) # Michael S. Branicky, Jun 30 2022
Comments