[go: up one dir, main page]

login
A347335
Lexicographically earliest sequence of distinct nonnegative integers such that the sum of three consecutive terms is a palindrome in base 10.
4
0, 1, 2, 3, 4, 15, 14, 26, 37, 25, 39, 13, 36, 6, 24, 47, 17, 35, 49, 27, 12, 5, 16, 23, 38, 40, 10, 51, 50, 20, 7, 28, 9, 18, 61, 22, 48, 29, 11, 59, 31, 21, 69, 41, 71, 19, 81, 91, 30, 60, 101, 111, 70, 122, 80, 90, 32, 100, 110, 42, 120, 130, 53, 8, 141, 63, 58, 121, 33, 68, 131, 43
OFFSET
1,3
EXAMPLE
a(1) + a(2) + a(3) = 0 + 1 + 2 = 3 (palindrome);
a(2) + a(3) + a(4) = 1 + 2 + 3 = 6 (palindrome);
a(3) + a(4) + a(5) = 2 + 3 + 4 = 9 (palindrome);
a(4) + a(5) + a(6) = 3 + 4 + 15 = 22 (palindrome); etc.
PROG
(Python)
def ispal(n): s = str(n); return s == s[::-1]
def aupton(terms):
alst, seen = [0, 1], {0, 1}
for n in range(2, terms):
an, partial_sum = 1, sum(alst[-2:])
while an in seen or not ispal(partial_sum + an): an += 1
alst.append(an); seen.add(an)
return alst
print(aupton(201)) # Michael S. Branicky, Aug 28 2021
CROSSREFS
Cf. A228730.
Sequence in context: A251637 A365436 A035047 * A348672 A334619 A037323
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Aug 28 2021
STATUS
approved