[go: up one dir, main page]

login
A368181
a(1) = 1; for n > 1, a(n) is the smallest positive integer that has not yet appeared which shares no digit with the sum of all previous terms a(1)..a(n-1).
2
1, 2, 4, 3, 5, 6, 7, 9, 8, 10, 11, 12, 13, 20, 22, 24, 23, 25, 14, 30, 15, 17, 33, 26, 16, 18, 19, 21, 27, 28, 31, 29, 34, 40, 41, 32, 35, 36, 38, 39, 37, 42, 44, 50, 43, 52, 45, 46, 47, 48, 49, 54, 55, 57, 56, 60, 53, 58, 59, 62, 63, 65, 70, 51, 61, 64, 66, 67, 69, 68, 71, 73, 74, 81, 90, 91, 77
OFFSET
1,2
COMMENTS
The sequence is finite; after 14594 terms, where a(14594) = 20858, the sum of all terms is 173658294 which contains the digits 1..9, so the next term does not exist.
The largest term is a(12742) = 888888.
LINKS
EXAMPLE
a(14) = 20 as the sum of all terms a(1)..a(13) = 91, and 20 is the smallest unused number that does not contain the digits 1 or 9.
PROG
(Python)
from itertools import islice
def agen():
s, aset, mink = 0, {0}, 1
while True:
k, dset = mink, set(str(s))
if dset >= set("123456789"): break
while k in aset or set(str(k)) & dset: k += 1
an = k; aset.add(an); s += an; yield an
while mink in aset: mink += 1
print(list(islice(agen(), 80))) # Michael S. Branicky, Dec 21 2023
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Scott R. Shannon, Dec 21 2023
STATUS
approved