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.

This page as a plain text file.
%I A340125 #33 Dec 30 2024 13:39:00
%S A340125 0,112,134,156,178,336,358,1223,1245,1267,1289,1447,1469,2334,2356,
%T A340125 2378,2558,3445,3467,3489,3669,4556,4578,5667,5689,6778,7889,11114,
%U A340125 11136,11158,11338,12225,12247,12269,12449,22233,22345,22367,22389,22556,22578,23447,23469,24455
%N A340125 Numbers whose sum of even digits and sum of odd digits are equal and whose digits are in nondecreasing order.
%H A340125 David A. Corneth, <a href="/A340125/b340125.txt">Table of n, a(n) for n = 1..10001</a>
%e A340125 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.
%t A340125 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 *)
%o A340125 (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] }
%o A340125 (Python)
%o A340125 def ok(n):
%o A340125   digs = list(map(int, str(n)))
%o A340125   return sorted(digs) == digs and sum(d*(-1)**d for d in digs) == 0
%o A340125 def aupto(lim): return [m for m in range(lim+1) if ok(m)]
%o A340125 print(aupto(24455)) # _Michael S. Branicky_, Feb 21 2021
%Y A340125 Intersection of A009994 and A036301.
%K A340125 nonn,base
%O A340125 1,2
%A A340125 _David A. Corneth_, Feb 21 2021