OFFSET
1,2
COMMENTS
See A350671 for the definition of "x has N digits in common with y".
Terms computed by Claudio Meller.
EXAMPLE
a(2) = 111 because it is the smallest number that has exactly three digits in common with a(1) = 1; similarly, a(3) = 10 because it is the smallest number that is not already in the sequence that has exactly three digits in common with a(2) = 111 and a(4) = 100 because it has three digits in common with a(3)= 10.
PROG
(Python)
from itertools import islice
def c(s, t): return sum(t.count(si) for si in s)
def agen(): # generator of terms
an, target, seen, mink = 1, "1", {1}, 2
while True:
yield an
k = mink
while k in seen or c(str(k), target) != 3: k += 1
an, target = k, str(k)
seen.add(an)
while mink in seen: mink += 1
print(list(islice(agen(), 56))) # Michael S. Branicky, Jan 30 2022
(PARI) isok(k, d, va) = {if (#select(x->(x==k), va), return(0)); my(dk=digits(k)); sum(i=1, #dk, #select(x->(x==dk[i]), d)) == 3; }
lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, my(k=1, d = digits(va[n-1])); while(!isok(k, d, va), k++); va[n] = k; ); va; } \\ Michel Marcus, Jan 31 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rodolfo Kurchan, Jan 30 2022
STATUS
approved