A341008 Numbers whose sum of even digits and sum of odd digits differ by 7.
7, 18, 29, 70, 81, 92, 108, 115, 126, 133, 144, 151, 162, 180, 209, 216, 238, 261, 283, 290, 313, 328, 331, 346, 364, 382, 414, 436, 441, 458, 463, 485, 511, 548, 566, 584, 612, 621, 634, 643, 656, 665, 678, 687, 700, 768, 786, 801, 810, 823, 832, 845, 854, 867, 876, 889, 898
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]] == 7 &] (* Amiram Eldar, Feb 02 2021 *)
-
Python
def ok(n): s = str(n) return abs(sum(map(int, s))-2*sum(int(d) for d in s if d in "2468")) == 7 print(list(filter(ok, range(900)))) # Michael S. Branicky, Jul 18 2021