login
A339139
Lexicographically earliest sequence of distinct nonnegative terms such that the last digit d of a(n), for n > 1, is the sum of the two closest digits of d (they are the leftmost digit of a(n+1) and the digit on the left of d).
2
1, 2, 12, 13, 23, 14, 34, 15, 45, 16, 56, 17, 67, 18, 78, 19, 89, 101, 102, 24, 25, 35, 26, 46, 27, 57, 28, 68, 29, 79, 201, 103, 36, 37, 47, 38, 58, 39, 69, 301, 104, 48, 49, 59, 401, 105, 501, 106, 601, 107, 701, 108, 801, 109, 901, 112, 113, 202, 203, 302, 204, 402, 205, 502, 206, 602, 207, 702, 208, 802, 209, 902
OFFSET
1,2
COMMENTS
The last two digits of a(n) must be in ascending order (thus no term of the sequence ends in 0).
LINKS
EXAMPLE
a(2) = 2 and 2 is the sum of 1 + 1 (closest digits to 2);
a(3) = 12 and 2 is the sum of 1 + 1 (closest digits to 2);
a(4) = 13 and 3 is the sum of 1 + 2 (closest digits to 3);
a(5) = 23 and 3 is the sum of 2 + 1 (closest digits to 3); etc.
PROG
(Python)
a = [1, 2, 12]
while len(a) < 72:
l = int(str(a[-1])[-1])-int(str(a[-1])[-2])
k = 10 * l
while k in a or k % 10 == 0 or int(str(k)[-1]) <= int(str(k)[-2]): k = k+1 if int(str(k+1)[0]) == l else l * (10 ** (len(str(k-1))))
a.append(k)
print(a) # Dominic McCarty, Jun 14 2025
CROSSREFS
Cf. A339138 (where the first digit is involved, instead of the last digit)
Sequence in context: A182271 A178362 A299961 * A143795 A032931 A072483
KEYWORD
base,nonn
AUTHOR
Eric Angelini, Nov 25 2020
STATUS
approved