OFFSET
1,3
COMMENTS
EXAMPLE
767 - (7+6+7) = 747 (another palindrome). So, 767 is in this sequence.
MATHEMATICA
palQ[n_]:=Module[{idn=IntegerDigits[n], idn2}, idn2=IntegerDigits[n - Total[idn]]; idn==Reverse[idn]&&idn2==Reverse[idn2]]; Select[Range[0, 2 10^6], palQ] (* Vincenzo Librandi, Apr 06 2015 *)
PROG
(Python)
def pal(n):
..r = ''
..for i in str(n):
....r = i + r
..return r == str(n)
def DS(n):
..s = 0
..for i in str(n):
....s += int(i)
..return s
{print(n, end=', ') for n in range(10**6) if pal(n) and pal(n-DS(n))}
## Simplified by Derek Orr, Apr 05 2015
(PARI) a(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); sum(i=1, #r, 10^(#r-i)*r[i])} \\ Code from David A. Corneth in A002113, Jun 06 2014
pal(n)=d=digits(n); Vecrev(d)==d
for(n=1, 10^7, s=sumdigits(a(n)); if(pal(a(n)-s), print1(a(n), ", "))) \\ Derek Orr, Apr 05 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Derek Orr, Sep 26 2013
STATUS
approved