A341009 Numbers whose sum of even digits and sum of odd digits differ by 8.
8, 17, 26, 35, 44, 53, 62, 71, 80, 107, 129, 170, 192, 206, 219, 224, 237, 242, 255, 260, 273, 291, 305, 327, 349, 350, 372, 394, 404, 422, 439, 440, 457, 475, 493, 503, 525, 530, 547, 552, 569, 574, 596, 602, 620, 659, 677, 695, 701, 710, 723, 732, 745, 754, 767, 776, 789
Offset: 1
Links
- Carole Dubois, Table of n, a(n) for n = 1..5001
Programs
-
Mathematica
Select[Range[1000], Abs[Plus @@ Select[(d = IntegerDigits[#]), OddQ] - Plus @@ Select[d, EvenQ]] == 8 &] (* Amiram Eldar, Feb 02 2021 *)
-
Python
def eodiff(n): digs = list(map(int, str(n))) return abs(sum(d for d in digs if d%2==0)-sum(d for d in digs if d%2==1)) def aupto(lim): return [m for m in range(lim+1) if eodiff(m) == 8] print(aupto(789)) # Michael S. Branicky, Feb 21 2021