login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers whose sum of even digits and sum of odd digits differ by 8.
2

%I #23 Feb 23 2021 11:42:24

%S 8,17,26,35,44,53,62,71,80,107,129,170,192,206,219,224,237,242,255,

%T 260,273,291,305,327,349,350,372,394,404,422,439,440,457,475,493,503,

%U 525,530,547,552,569,574,596,602,620,659,677,695,701,710,723,732,745,754,767,776,789

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

%H Carole Dubois, <a href="/A341009/b341009.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]] == 8 &] (* _Amiram Eldar_, Feb 02 2021 *)

%o (Python)

%o def eodiff(n):

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

%o return abs(sum(d for d in digs if d%2==0)-sum(d for d in digs if d%2==1))

%o def aupto(lim): return [m for m in range(lim+1) if eodiff(m) == 8]

%o print(aupto(789)) # _Michael S. Branicky_, Feb 21 2021

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

%K base,nonn

%O 1,1

%A _Eric Angelini_ and _Carole Dubois_, Feb 02 2021