login
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

%I #21 Mar 24 2021 23:05:20

%S 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,

%T 29,31,33,32,34,35,36,38,39,41,42,43,37,44,45,46,47,48,51,149,53,49,

%U 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

%N 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).

%C 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).

%H Scott R. Shannon, <a href="/A342441/a342441.png">Image of the first 100000 terms</a>. The green line is a(n) = n.

%e a(2) = 2 as a(1)+2 = 1+2 = 3 which shares no digit with a(1) = 1 or 2.

%e 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.

%e 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.

%t 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 *)

%o (Python)

%o def aupton(terms):

%o alst, aset = [1], {1}

%o while len(alst) < terms:

%o an, anm1_digs = 2, set(str(alst[-1]))

%o while True:

%o while an in aset: an += 1

%o if (set(str(an)) | anm1_digs) & set(str(an+alst[-1])) == set():

%o alst.append(an); aset.add(an); break

%o an += 1

%o return alst

%o print(aupton(73)) # _Michael S. Branicky_, Mar 20 2021

%Y Cf. A342442 (multiplication), A276633, A010784, A043537, A043096, A338466, A336285.

%K nonn,base

%O 1,2

%A _Scott R. Shannon_, Mar 12 2021