A347400 Lexicographically earliest sequence of distinct terms > 0 such that concatenating n to a(n) forms a palindrome in base 10.
1, 2, 3, 4, 5, 6, 7, 8, 9, 101, 11, 21, 31, 41, 51, 61, 71, 81, 91, 102, 12, 22, 32, 42, 52, 62, 72, 82, 92, 103, 13, 23, 33, 43, 53, 63, 73, 83, 93, 104, 14, 24, 34, 44, 54, 64, 74, 84, 94, 105, 15, 25, 35, 45, 55, 65, 75, 85, 95, 106, 16, 26, 36, 46, 56, 66, 76, 86, 96, 107, 17, 27, 37, 47, 57
Offset: 1
Examples
For n = 8 we have a(8) = 8 and 88 is a palindrome in base 10; for n = 9 we have a(9) = 9 and 99 is a palindrome in base 10; for n = 10 we have a(10) = 101 and 10101 is a palindrome in base 10; for n = 11 we have a(11) = 11 and 1111 is a palindrome in base 10; for n = 12 we have a(12) = 21 and 1221 is a palindrome in base 10; etc.
Programs
-
Python
def ispal(s): 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(str(n) + str(an)): an += 1 alst.append(an); seen.add(an) return alst print(aupton(200)) # Michael S. Branicky, Aug 30 2021
Comments