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!)
A087141 Numbers divisible by the sum of their digits, but not by all their individual digits. 4

%I #14 Oct 18 2021 08:39:00

%S 10,18,20,21,27,30,40,42,45,50,54,60,63,70,72,80,81,84,90,100,102,108,

%T 110,114,117,120,133,140,150,152,153,156,171,180,190,192,195,198,200,

%U 201,204,207,209,210,220,225,228,230,234,240,243,247,252,261,266,270

%N Numbers divisible by the sum of their digits, but not by all their individual digits.

%H David A. Corneth, <a href="/A087141/b087141.txt">Table of n, a(n) for n = 1..10000</a>

%e 225 is in the sequence as 225 is divisible by 2 + 2 + 5 = 9 but not by 2 while 2 is a digit of 225. - _David A. Corneth_, Jan 28 2021

%o (PARI) is(n) = { my(d = digits(n), sd = vecsum(d), s = Set(d)); if(sd != 0 && n % sd == 0, if(s[1] == 0, return(1) ); for(i = 1, #s, if(n % s[i] != 0, return(1) ) ); 0 ); 0 } \\ _David A. Corneth_, Jan 28 2021

%o (Python)

%o def ok(n):

%o d = list(map(int, str(n)))

%o if n == 0 or n%sum(d): return False

%o return 0 in d or any(n%di for di in set(d))

%o print([k for k in range(271) if ok(k)]) # _Michael S. Branicky_, Oct 18 2021

%Y Intersection of A087140 and A005349.

%Y Cf. A087142.

%K nonn,base

%O 1,1

%A _Reinhard Zumkeller_, Aug 18 2003

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 07:35 EDT 2024. Contains 371922 sequences. (Running on oeis4.)