login
A351840
Lexicographically earliest infinite sequence of distinct positive integers such that a(1) = 1 and a(n-1) + a(n) is divisible by the first digit of a(n).
2
1, 10, 2, 11, 12, 3, 13, 14, 7, 15, 5, 16, 4, 17, 18, 6, 19, 21, 23, 25, 27, 9, 29, 31, 32, 8, 20, 22, 24, 26, 28, 35, 34, 38, 37, 43, 41, 47, 45, 30, 33, 36, 39, 49, 51, 54, 42, 46, 59, 56, 40, 44, 48, 52, 53, 57, 58, 62, 64, 68, 72, 60, 50, 55, 65, 61, 79, 75, 63, 69, 71, 67, 73, 74, 86, 82, 98, 70
OFFSET
1,2
COMMENTS
This sequence is a permutation of the positive integers.
First differs from A323821 at a(32).
EXAMPLE
a(1) + a(2) = 1 + 10 = 11 which is divisible by 1 (the first digit of 10);
a(2) + a(3) = 10 + 2 = 12 which is divisible by 2 (the first digit of 2);
a(3) + a(4) = 2 + 11 = 13 which is divisible by 1 (the first digit of 11);
a(4) + a(5) = 11 + 12 = 23 which is divisible by 1 (the first digit of 12);
a(5) + a(6) = 12 + 3 = 15 which is divisible by 3 (the first digit of 3); etc.
MATHEMATICA
nn = 78; c[_] = 0; a[1] = c[1] = u = 1; Do[While[c[u] != 0, u++]; k = u; While[Nand[c[k] == 0, Mod[a[n - 1] + k, First@ IntegerDigits[k]] == 0], k++]; 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 (alst[-1]+an)%int(str(an)[0]): an += 1
alst.append(an); aset.add(an)
while minunused in aset: minunused += 1
return alst
print(aupton(100)) # Michael S. Branicky, Feb 21 2022
CROSSREFS
Cf. A323821.
Sequence in context: A293869 A365625 A323821 * A257277 A248024 A269631
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Feb 21 2022
STATUS
approved