[go: up one dir, main page]

login
A351479
Numbers whose sum of odd digits is twice the sum of even digits.
1
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,1
COMMENTS
The sequence is closed under concatenation (if k and m are terms, so are k.m and m.k); permutation of a term's string of digits; and insertion of 0's within a term's string of digits. - Michael S. Branicky, Feb 12 2022
EXAMPLE
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).
MATHEMATICA
Select[Range[2000], Plus @@ Select[IntegerDigits[#], OddQ] == 2 * Plus @@ Select[IntegerDigits[#], EvenQ] &] (* Amiram Eldar, Feb 12 2022 *)
PROG
(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
CROSSREFS
Sequence in context: A341992 A077378 A031509 * A247616 A119426 A138059
KEYWORD
base,nonn
AUTHOR
Carole Dubois and Eric Angelini, Feb 12 2022
STATUS
approved