A347336 Lexicographically earliest sequence of distinct positive integers such that the concatenation of a(n) and a(n+1) added to a(n+2) is a palindrome in base 10.
1, 2, 10, 12, 99, 32, 67, 66, 120, 46, 75, 209, 48, 64, 20, 26, 86, 196, 72, 19, 8, 4, 15, 9, 22, 7, 5, 13, 42, 319, 105, 808, 793, 1115, 282, 829, 553, 375, 1080, 493, 308, 1186, 617, 194, 522, 1069, 156, 445, 206, 338, 264, 569, 993, 82, 17, 11, 60, 61, 55, 71, 94, 33, 16, 127, 34, 87
Offset: 1
Examples
[a(1), a(2)] + a(3) = [1, 2] + 10 = 12 + 10 = 22 (palindrome); [a(2), a(3)] + a(4) = [2, 10] + 12 = 210 + 12 = 222 (palindrome); [a(3), a(4)] + a(5) = [10, 12] + 99 = 1012 + 99 = 1111 (palindrome); [a(4), a(5)] + a(6) = [12, 99] + 32 = 1299 + 32 = 1331 (palindrome); etc.
Programs
-
Python
def ispal(n): s = str(n); return s == s[::-1] def aupton(terms): alst, seen = [1, 2], {1, 2} for n in range(2, terms): an, partial_sum = 1, int(str(alst[-2]) + str(alst[-1])) while an in seen or not ispal(partial_sum + an): an += 1 alst.append(an); seen.add(an) return alst print(aupton(66)) # Michael S. Branicky, Aug 28 2021