OFFSET
0,3
LINKS
Harry J. Smith, Table of n, a(n) for n = 0..1000
EXAMPLE
17 is a term hence the next term is 27, as 17 + 27 = 44 is a palindrome, but 17 + 18 = 35 through 17 + 26 = 43 are not palindromes.
MATHEMATICA
palQ[n_] := Block[{d = IntegerDigits@ n}, Reverse@ d == d]; a = {1}; Do[k = a[[n - 1]] + 1; While[! palQ[a[[n - 1]] + k], k++]; AppendTo[a, k], {n, 2, 58}]; {0}~Join~a (* Michael De Vlieger, Oct 05 2015 *)
PROG
(PARI) digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) }
Palin(x)= { local(y, d, e, f); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) }
{ for (n=1, 1000, if (n>1, while (!Palin(a1 + a++), ); a1=a, a=a1=1); write("b062932.txt", n, " ", a) ) } \\ Harry J. Smith, Aug 13 2009
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Amarnath Murthy, Jul 05 2001
EXTENSIONS
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 02 2001
Initial a(0)=0 prefixed by M. F. Hasler, Nov 09 2013
STATUS
approved