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!)
A341005 Numbers whose sum of even digits and sum of odd digits differ by 4. 2

%I #20 Apr 15 2021 10:43:31

%S 4,13,22,31,40,103,116,125,130,138,147,152,161,169,174,183,196,202,

%T 215,220,233,251,301,310,318,323,332,345,354,367,376,381,389,398,400,

%U 417,435,453,471,512,521,534,543,556,565,578,587,611,619,637,655,673,691,714,736,741,758

%N Numbers whose sum of even digits and sum of odd digits differ by 4.

%H Carole Dubois, <a href="/A341005/b341005.txt">Table of n, a(n) for n = 1..5001</a>

%t Select[Range[1000], Abs[Plus @@ Select[(d = IntegerDigits[#]), OddQ] - Plus @@ Select[d, EvenQ]] == 4 &] (* _Amiram Eldar_, Feb 02 2021 *)

%o (Python)

%o def ok(n):

%o sums = [0, 0]

%o for d in str(n): sums[d in "13579"] += int(d)

%o return abs(sums[0] - sums[1]) == 4

%o print(list(filter(ok, range(759)))) # _Michael S. Branicky_, Apr 13 2021

%Y Cf. A036301 (sums are equal), A341002 to A341010 (sums differ by 1 to 9).

%Y Cf. A071650 (difference between sum of even and sum of odd digits).

%K nonn,base

%O 1,1

%A _Eric Angelini_ and _Carole Dubois_, Feb 02 2021

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 May 5 00:40 EDT 2024. Contains 372257 sequences. (Running on oeis4.)