A347401 Lexicographically earliest sequence of distinct terms > 0 such that the sum n + a(n) forms a palindrome in base 10.
1, 2, 3, 4, 6, 5, 15, 14, 13, 12, 11, 10, 9, 8, 7, 17, 16, 26, 25, 24, 23, 22, 21, 20, 19, 18, 28, 27, 37, 36, 35, 34, 33, 32, 31, 30, 29, 39, 38, 48, 47, 46, 45, 44, 43, 42, 41, 40, 50, 49, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 80, 79, 78, 77, 76, 75, 74, 73
Offset: 1
Examples
For n = 4 we have a(4) = 4 and 4 + 4 = 8 is a palindrome in base 10; for n = 5 we have a(5) = 6 and 5 + 6 = 11 is a palindrome in base 10; for n = 6 we have a(6) = 5 and 6 + 5 = 11 is a palindrome in base 10; for n = 7 we have a(7) = 15 and 7 + 15 = 22 is a palindrome in base 10; for n = 8 we have a(8) = 14 and 8 + 14 = 22 is a palindrome in base 10; etc.
Programs
-
Python
def ispal(n): s = str(n); return s == s[::-1] def aupton(terms): alst, seen = [1], {1} for n in range(2, terms+1): an = 1 while an in seen or not ispal(n + an): an += 1 alst.append(an); seen.add(an) return alst print(aupton(200)) # Michael S. Branicky, Aug 30 2021