login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A082232 Palindromes divisible by their digit sum. 2
1, 2, 3, 4, 5, 6, 7, 8, 9, 111, 171, 222, 252, 333, 414, 444, 555, 666, 777, 828, 888, 999, 2112, 2772, 2992, 4224, 4554, 4774, 6336, 6556, 8118, 8338, 8448, 10101, 10701, 10901, 11511, 12321, 13131, 15751, 18981, 19791, 20202, 20502, 20702, 21012, 21112 (list; graph; refs; listen; history; text; internal format)
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

Sequence in context: A106003 A283868 A087995 * A117228 A032567 A134853

Adjacent sequences:  A082229 A082230 A082231 * A082233 A082234 A082235

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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 17 11:59 EDT 2019. Contains 328110 sequences. (Running on oeis4.)