login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Lexicographically earliest infinite sequence of distinct positive integers such that a(1) = 1 and a(n) + a(n+1) is divisible by the last digit of a(n+1). No term ending in zero is allowed in the sequence.
1

%I #22 Feb 22 2022 21:25:54

%S 1,11,13,21,3,31,23,41,43,27,9,33,37,47,51,39,17,19,53,61,29,71,73,67,

%T 59,49,7,77,81,63,91,83,57,69,93,101,79,111,121,113,97,119,103,107,

%U 109,87,123,129,131,133,141,151,143,137,157,149,117,99,153,127,89,161,147,159,171,181,173,163

%N Lexicographically earliest infinite sequence of distinct positive integers such that a(1) = 1 and a(n) + a(n+1) is divisible by the last digit of a(n+1). No term ending in zero is allowed in the sequence.

%C Only terms ending in 1, 3, 7 or 9 are in the sequence.

%C Proof. If a(n-1) is odd, then a(n) cannot be even; otherwise, their sum would be odd and hence not divisible by a(n)'s last, even digit. For sake of contradiction, let a(n) be the first term in the sequence that ends in 5; then a(n-1) + a(n) ends in 0 and a(n-1) ends in 5 (a contradiction to a(n)'s being the first such term) or a(n-1) + a(n) ends in 5, which means a(n-1) ends in 0 (not allowed). - _Michael S. Branicky_, Feb 21 2022

%H Carole Dubois, <a href="/A351841/b351841.txt">Table of n, a(n) for n = 1..4016</a>

%e a(1) + a(2) = 1 + 11 = 12 which is divisible by 1 (the last digit of 11);

%e a(2) + a(3) = 11 + 13 = 24 which is divisible by 3 (the last digit of 13);

%e a(3) + a(4) = 13 + 21 = 34 which is divisible by 1 (the last digit of 21);

%e a(4) + a(5) = 21 + 3 = 24 which is divisible by 3 (the last digit of 3);

%e a(5) + a(6) = 3 + 31 = 34 which is divisible by 1 (the last digit of 31);

%e a(6) + a(7) = 31 + 23 = 54 which is divisible by 3 (the last digit of 23); etc.

%t nn = 67; f[n_] := (5 n + Mod[3 n + 2, 4] - 4)/2; c[_] = 0; a[1] = c[1] = u = 1; Do[While[c[Set[v, f[u]]] != 0, u++]; j = v; While[Nand[c[#2] == 0, Mod[#1 + #2, Mod[#2, 10]] == 0] & @@ {a[n - 1], Set[k, f[j]]}, j++]; Set[{a[n], c[k]}, {k, n}], {n, 2, nn}]; Array[a[#] &, nn] (* _Michael De Vlieger_, Feb 21 2022 *)

%o (Python)

%o def aupton(terms):

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

%o while len(alst) < terms:

%o an = minunused

%o while an in aset or (an%10 == 0 or (alst[-1]+an)%(an%10)): an += 1

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

%o while minunused in aset: minunused += 1

%o return alst

%o print(aupton(78)) # _Michael S. Branicky_, Feb 21 2022

%Y Cf. A351840.

%K base,nonn

%O 1,2

%A _Eric Angelini_ and _Carole Dubois_, Feb 21 2022