login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A351059 a(n) is the smallest number not yet in the sequence that has three digits in common with a(n-1), starting with a(1) = 1. 2
1, 111, 10, 100, 102, 101, 103, 110, 104, 114, 14, 141, 41, 144, 124, 112, 12, 121, 21, 122, 120, 200, 20, 202, 201, 210, 211, 123, 113, 13, 131, 31, 133, 130, 300, 30, 303, 203, 220, 204, 222, 2, 1222, 23, 223, 32, 232, 132, 212, 125, 115, 15, 151, 51, 155, 105 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
See A350671 for the definition of "x has N digits in common with y".
Terms computed by Claudio Meller.
LINKS
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
Sequence in context: A123727 A282915 A367813 * A279800 A282360 A279941
KEYWORD
nonn,base
AUTHOR
Rodolfo Kurchan, Jan 30 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 21 08:06 EDT 2024. Contains 373543 sequences. (Running on oeis4.)