OFFSET
1,2
COMMENTS
Only terms ending in 1, 3, 7 or 9 are in the sequence.
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
LINKS
Carole Dubois, Table of n, a(n) for n = 1..4016
EXAMPLE
a(1) + a(2) = 1 + 11 = 12 which is divisible by 1 (the last digit of 11);
a(2) + a(3) = 11 + 13 = 24 which is divisible by 3 (the last digit of 13);
a(3) + a(4) = 13 + 21 = 34 which is divisible by 1 (the last digit of 21);
a(4) + a(5) = 21 + 3 = 24 which is divisible by 3 (the last digit of 3);
a(5) + a(6) = 3 + 31 = 34 which is divisible by 1 (the last digit of 31);
a(6) + a(7) = 31 + 23 = 54 which is divisible by 3 (the last digit of 23); etc.
MATHEMATICA
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 *)
PROG
(Python)
def aupton(terms):
alst, aset, minunused = [1], {1}, 2
while len(alst) < terms:
an = minunused
while an in aset or (an%10 == 0 or (alst[-1]+an)%(an%10)): an += 1
alst.append(an); aset.add(an)
while minunused in aset: minunused += 1
return alst
print(aupton(78)) # Michael S. Branicky, Feb 21 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Feb 21 2022
STATUS
approved