login
A341005
Numbers whose sum of even digits and sum of odd digits differ by 4.
2
4, 13, 22, 31, 40, 103, 116, 125, 130, 138, 147, 152, 161, 169, 174, 183, 196, 202, 215, 220, 233, 251, 301, 310, 318, 323, 332, 345, 354, 367, 376, 381, 389, 398, 400, 417, 435, 453, 471, 512, 521, 534, 543, 556, 565, 578, 587, 611, 619, 637, 655, 673, 691, 714, 736, 741, 758
OFFSET
1,1
LINKS
MATHEMATICA
Select[Range[1000], Abs[Plus @@ Select[(d = IntegerDigits[#]), OddQ] - Plus @@ Select[d, EvenQ]] == 4 &] (* Amiram Eldar, Feb 02 2021 *)
PROG
(Python)
def ok(n):
sums = [0, 0]
for d in str(n): sums[d in "13579"] += int(d)
return abs(sums[0] - sums[1]) == 4
print(list(filter(ok, range(759)))) # Michael S. Branicky, Apr 13 2021
CROSSREFS
Cf. A036301 (sums are equal), A341002 to A341010 (sums differ by 1 to 9).
Cf. A071650 (difference between sum of even and sum of odd digits).
Sequence in context: A067396 A017209 A052218 * A183148 A202089 A339804
KEYWORD
nonn,base
AUTHOR
Eric Angelini and Carole Dubois, Feb 02 2021
STATUS
approved