login
A342441
a(1) = 1; for n > 1, a(n) is the least positive integer not occurring earlier such that a(n-1)+a(n) shares no digit with either a(n-1) or a(n).
7
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 17, 16, 18, 12, 21, 19, 25, 22, 23, 26, 24, 27, 28, 29, 31, 33, 32, 34, 35, 36, 38, 39, 41, 42, 43, 37, 44, 45, 46, 47, 48, 51, 149, 53, 49, 52, 54, 55, 56, 57, 59, 58, 63, 64, 65, 66, 67, 68, 62, 69, 72, 73, 75, 85, 77, 74, 76, 78, 82, 79
OFFSET
1,2
COMMENTS
No term can end in 0 as that would result in the last digit of a(n-1) being the same as the last digit of a(n-1)+a(n).
LINKS
Scott R. Shannon, Image of the first 100000 terms. The green line is a(n) = n.
EXAMPLE
a(2) = 2 as a(1)+2 = 1+2 = 3 which shares no digit with a(1) = 1 or 2.
a(10) = 11 as a(9)+11 = 9+11 = 20 which shares no digit with a(9) = 9 or 11. Note that the first number skipped is 10 as 9+10 = 19 which shares a digit with 9.
a(11) = 13 as a(10)+13 = 11+13 = 24 which shares no digit with a(10) = 11 or 13. Note that the number 12 is skipped as 11+12 = 23 which shares a digit with 12.
MATHEMATICA
Block[{a = {1}, m = {1}, d, s, k}, Do[k = 2; While[Nand[FreeQ[a, k], ! IntersectingQ[Set[d, IntegerDigits[k]], Set[s, IntegerDigits[a[[-1]] + k]]], ! IntersectingQ[s, m]], k++]; AppendTo[a, k]; Set[m, d], 72]; a] (* Michael De Vlieger, Mar 20 2021 *)
PROG
(Python)
def aupton(terms):
alst, aset = [1], {1}
while len(alst) < terms:
an, anm1_digs = 2, set(str(alst[-1]))
while True:
while an in aset: an += 1
if (set(str(an)) | anm1_digs) & set(str(an+alst[-1])) == set():
alst.append(an); aset.add(an); break
an += 1
return alst
print(aupton(73)) # Michael S. Branicky, Mar 20 2021
CROSSREFS
Cf. A342442 (multiplication), A276633, A010784, A043537, A043096, A338466, A336285.
Sequence in context: A359075 A247761 A031185 * A129562 A191841 A331125
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Mar 12 2021
STATUS
approved