A228730 Lexicographically earliest sequence of distinct nonnegative integers such that the sum of two consecutive terms is a palindrome in base 10.
0, 1, 2, 3, 4, 5, 6, 16, 17, 27, 28, 38, 39, 49, 50, 51, 15, 7, 26, 18, 37, 29, 48, 40, 59, 42, 13, 9, 24, 20, 35, 31, 46, 53, 58, 8, 14, 19, 25, 30, 36, 41, 47, 52, 69, 32, 12, 10, 23, 21, 34, 43, 45, 54, 57, 44, 11, 22, 33, 55, 56, 65, 66, 75, 76, 85, 86, 95, 96
Offset: 0
Examples
a(1) + a(2) = 3. a(2) + a(3) = 5. a(3) + a(4) = 7. a(4) + a(5) = 9. a(5) + a(6) = 11. a(6) + a(7) = 22. a(7) + a(8) = 33.
Links
- Paul Tek, Table of n, a(n) for n = 0..10000 (corrected by Michel Marcus, Jan 19 2019)
- Paul Tek, PERL program for this sequence
Programs
-
PARI
{a=0;u=0; for(n=1, 99, u+=1<A002113(a+k)&&(a=k)&&next(2)))} \\ M. F. Hasler, Nov 09 2013
-
Perl
See Link section.
-
Python
from itertools import islice def ispal(n): s = str(n); return s == s[::-1] def agen(): # generator of terms aset, an, mink = {0}, 0, 1 yield 0 while True: k = mink while k in aset or not ispal(an + k): k += 1 an = k; aset.add(an); yield an while mink in aset: mink += 1 print(list(islice(agen(), 70))) # Michael S. Branicky, Nov 07 2022
Extensions
a(0)=0 added by M. F. Hasler, Nov 15 2013
Comments