cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A351479 Numbers whose sum of odd digits is twice the sum of even digits.

Original entry on oeis.org

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

Views

Author

Carole Dubois and Eric Angelini, Feb 12 2022

Keywords

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

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).
		

Crossrefs

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
Showing 1-1 of 1 results.