OFFSET
1,2
REFERENCES
P. J. Costello, More Palindromic Niven Numbers, Journal of Recreational Mathematics, vol. 33:1 pp. 18-21 2004-5 Baywood Amityville NY.
W. McDaniel, Palindromic Niven Numbers, Journal of Recreational Mathematics, vol. 24 pp. 164-6 1992 Baywood Amityville NY.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
MAPLE
dmax:= 6; # to get all terms with at most dmax digits
f1:= proc(n)
local L, Ln, i, r, s, p;
L:= convert(n, base, 10);
Ln:= nops(L);
r:= add(L[i]*10^(Ln-i), i=1..Ln);
s:= convert(L, `+`);
p:= 10^Ln*n+r;
if p mod (2*s) = 0 then p else NULL fi;
end proc:
f2:= proc(n, d)
local L, Ln, i, r, s, p;
L:= convert(n, base, 10);
Ln:= nops(L);
r:= add(L[i]*10^(Ln-i), i=1..Ln);
s:= convert(L, `+`);
p:= 10^(1+Ln)*n+10^Ln*d+r;
if p mod(2*s+d) = 0 then p else NULL fi;
end proc:
A:= {$1..9}:
for d from 2 to dmax do
if d::even then
A:= A union {seq(f1(x), x=10^(d/2-1) .. 10^(d/2)-1)}
else
A:= A union {seq(seq(f2(x, y), x=10^((d-1)/2-1) .. 10^((d-1)/2)-1), y=0..9)}
fi
od:
A; # Robert Israel, Aug 22 2014
MATHEMATICA
d[n_] := IntegerDigits[n]; Select[Range[20800], Reverse[x = d[#]] == x && Divisible[#, Plus @@ d[#]] &] (* Jayanta Basu, Jul 13 2013 *)
PROG
(Python)
A082232 = sorted([int(str(x)+str(x)[::-1]) for x in range(1, 10**5) if not
....int(str(x)+str(x)[::-1]) % sum((int(d) for d in str(x)+str(x)[::-1]))]
....+ [int(str(x)+str(x)[-2::-1]) for x in range(1, 10**5) if not
....int(str(x)+str(x)[-2::-1]) % sum((int(d) for d in str(x)+str(x)[-2::-1]))]) # Chai Wah Wu, Aug 22 2014
(PARI)
rev(n)=r=""; d=digits(n); for(i=1, #d, r=concat(Str(d[i]), r)); eval(r)
for(n=1, 10^5, if(rev(n)==n, if(n%sumdigits(n)==0, print1(n, ", ")))) \\ Derek Orr, Aug 25 2014
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Apr 09 2003
EXTENSIONS
Corrected and extended by Giovanni Resta, Feb 08 2006
More terms from Chai Wah Wu, Aug 22 2014
STATUS
approved