login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A082232 Palindromes divisible by their digit sum. 4

%I #21 Aug 26 2014 03:58:01

%S 1,2,3,4,5,6,7,8,9,111,171,222,252,333,414,444,555,666,777,828,888,

%T 999,2112,2772,2992,4224,4554,4774,6336,6556,8118,8338,8448,10101,

%U 10701,10901,11511,12321,13131,15751,18981,19791,20202,20502,20702,21012,21112

%N Palindromes divisible by their digit sum.

%D P. J. Costello, More Palindromic Niven Numbers, Journal of Recreational Mathematics, vol. 33:1 pp. 18-21 2004-5 Baywood Amityville NY.

%D W. McDaniel, Palindromic Niven Numbers, Journal of Recreational Mathematics, vol. 24 pp. 164-6 1992 Baywood Amityville NY.

%H Chai Wah Wu, <a href="/A082232/b082232.txt">Table of n, a(n) for n = 1..10000</a>

%p dmax:= 6; # to get all terms with at most dmax digits

%p f1:= proc(n)

%p local L, Ln, i,r,s,p;

%p L:= convert(n, base, 10);

%p Ln:= nops(L);

%p r:= add(L[i]*10^(Ln-i), i=1..Ln);

%p s:= convert(L,`+`);

%p p:= 10^Ln*n+r;

%p if p mod (2*s) = 0 then p else NULL fi;

%p end proc:

%p f2:= proc(n,d)

%p local L, Ln, i,r,s,p;

%p L:= convert(n, base, 10);

%p Ln:= nops(L);

%p r:= add(L[i]*10^(Ln-i), i=1..Ln);

%p s:= convert(L,`+`);

%p p:= 10^(1+Ln)*n+10^Ln*d+r;

%p if p mod(2*s+d) = 0 then p else NULL fi;

%p end proc:

%p A:= {$1..9}:

%p for d from 2 to dmax do

%p if d::even then

%p A:= A union {seq(f1(x),x=10^(d/2-1) .. 10^(d/2)-1)}

%p else

%p A:= A union {seq(seq(f2(x,y),x=10^((d-1)/2-1) .. 10^((d-1)/2)-1),y=0..9)}

%p fi

%p od:

%p A; # _Robert Israel_, Aug 22 2014

%t d[n_] := IntegerDigits[n]; Select[Range[20800], Reverse[x = d[#]] == x && Divisible[#, Plus @@ d[#]] &] (* _Jayanta Basu_, Jul 13 2013 *)

%o (Python)

%o A082232 = sorted([int(str(x)+str(x)[::-1]) for x in range(1,10**5) if not

%o ....int(str(x)+str(x)[::-1]) % sum((int(d) for d in str(x)+str(x)[::-1]))]

%o ....+ [int(str(x)+str(x)[-2::-1]) for x in range(1,10**5) if not

%o ....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

%o (PARI)

%o rev(n)=r="";d=digits(n);for(i=1,#d,r=concat(Str(d[i]),r));eval(r)

%o for(n=1,10^5,if(rev(n)==n,if(n%sumdigits(n)==0,print1(n,", ")))) \\ _Derek Orr_, Aug 25 2014

%K base,nonn

%O 1,2

%A _Amarnath Murthy_, Apr 09 2003

%E Corrected and extended by _Giovanni Resta_, Feb 08 2006

%E More terms from _Chai Wah Wu_, Aug 22 2014

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 06:24 EDT 2024. Contains 371918 sequences. (Running on oeis4.)