A351479 Numbers whose sum of odd digits is twice the sum of even digits.
123, 132, 147, 174, 213, 231, 312, 321, 345, 354, 369, 396, 417, 435, 453, 471, 534, 543, 567, 576, 639, 657, 675, 693, 714, 741, 756, 765, 789, 798, 879, 897, 936, 963, 978, 987, 1023, 1032, 1047, 1074, 1203, 1227, 1230, 1272, 1302, 1320, 1407, 1470, 1704, 1722, 1740, 2013, 2031, 2103, 2127, 2130, 2172
Offset: 1
Examples
a(1) = 123 whose sum of odd digits (4) is twice the sum of even digits (2); a(2) = 132 whose sum of odd digits (4) is twice the sum of even digits (2); a(3) = 147 whose sum of odd digits (8) is twice the sum of even digits (4).
Programs
-
Mathematica
Select[Range[2000], Plus @@ Select[IntegerDigits[#], OddQ] == 2 * Plus @@ Select[IntegerDigits[#], EvenQ] &] (* Amiram Eldar, Feb 12 2022 *)
-
Python
def ok(n): ds = list(map(int, str(n))) return sum(d for d in ds if d%2==1) == 2*sum(d for d in ds if d%2==0) print([k for k in range(1, 2173) if ok(k)]) # Michael S. Branicky, Feb 12 2022
Comments