OFFSET
1,3
EXAMPLE
4774 is in the sequence because (1) it is a palindrome and (2) the sum of its digits 4 + 7 + 7 + 4 = 22 is also a palindrome.
MAPLE
rev := proc (n) local nn; nn := convert(n, base, 10): add(nn[j]*10^(nops(nn)-j), j = 1 .. nops(nn)) end proc: sd := proc (n) options operator, arrow: add(convert(n, base, 10)[j], j = 1 .. nops(convert(n, base, 10))) end proc: a := proc (n) if rev(n) = n and rev(sd(n)) = sd(n) then n else end if end proc: seq(a(n), n = 0 .. 5000); # Emeric Deutsch, Jan 18 2009
MATHEMATICA
d[n_]:=IntegerDigits[n]; sod[n_]:=Total[d[n]]; palQ[n_]:=Reverse[x=d[n]]==x; t={}; Do[If[palQ[n] && palQ[sod[n]], AppendTo[t, n]], {n, 0, 4005}]; t (* Jayanta Basu, May 15 2013 *)
PROG
(Python)
from itertools import chain, count, islice
def A082208_gen(): # generator of terms
return filter(lambda n:(s:=str(sum(int(d) for d in str(n))))[:(t:=(len(s)+1)//2)]==s[:-t-1:-1], chain((0, ), chain.from_iterable(chain((int((s:=str(d))+s[-2::-1]) for d in range(10**l, 10**(l+1))), (int((s:=str(d))+s[::-1]) for d in range(10**l, 10**(l+1)))) for l in count(0))))
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Apr 10 2003
EXTENSIONS
More terms from Luc Stevens (lms022(AT)yahoo.com), Apr 16 2006; corrected Apr 18 2006; corrected Apr 20 2006
Edited by N. J. A. Sloane, Jan 14 2009 at the suggestion of Ian Kent
STATUS
approved