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.

A340125 Numbers whose sum of even digits and sum of odd digits are equal and whose digits are in nondecreasing order.

Original entry on oeis.org

0, 112, 134, 156, 178, 336, 358, 1223, 1245, 1267, 1289, 1447, 1469, 2334, 2356, 2378, 2558, 3445, 3467, 3489, 3669, 4556, 4578, 5667, 5689, 6778, 7889, 11114, 11136, 11158, 11338, 12225, 12247, 12269, 12449, 22233, 22345, 22367, 22389, 22556, 22578, 23447, 23469, 24455
Offset: 1

Views

Author

David A. Corneth, Feb 21 2021

Keywords

Examples

			1223 is in the sequence as the sum of the odd digits is 1 + 3 = 4 and the sum of the even digits is 2 + 2 = 4 are equal.
		

Crossrefs

Intersection of A009994 and A036301.

Programs

  • Mathematica
    seodQ[n_]:=With[{idn=IntegerDigits[n]},Total[Select[idn,EvenQ]]==Total[Select[idn,OddQ]]&&Min[Differences[idn]]>=0]; Select[Range[0,25000],seodQ] (* Harvey P. Dale, Dec 30 2024 *)
  • PARI
    is(n) = { my(d = digits(n), w = vector(2)); if(d != vecsort(d), return(0)); for(i = 1, #d, w[d[i]%2 + 1] += d[i] ); w[1] == w[2] }
    
  • Python
    def ok(n):
      digs = list(map(int, str(n)))
      return sorted(digs) == digs and sum(d*(-1)**d for d in digs) == 0
    def aupto(lim): return [m for m in range(lim+1) if ok(m)]
    print(aupto(24455)) # Michael S. Branicky, Feb 21 2021