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.

A036301 Numbers whose sum of even digits and sum of odd digits are equal.

This page as a plain text file.
%I A036301 #38 Aug 12 2023 01:05:58
%S A036301 0,112,121,134,143,156,165,178,187,211,314,336,341,358,363,385,413,
%T A036301 431,516,538,561,583,615,633,651,718,781,817,835,853,871,1012,1021,
%U A036301 1034,1043,1056,1065,1078,1087,1102,1120,1201,1210,1223,1232,1245,1254,1267,1276,1289,1298
%N A036301 Numbers whose sum of even digits and sum of odd digits are equal.
%H A036301 John Cerkan, <a href="/A036301/b036301.txt">Table of n, a(n) for n = 1..10000</a>
%F A036301 This set A036301 = { n | A071650(n) = 0 }. - _M. F. Hasler_, Aug 11 2023
%t A036301 Select[Range[0,10000], Plus @@Select[IntegerDigits[ # ], OddQ]\[Equal]Plus @@Select[IntegerDigits[ # ], EvenQ]&] (* _Zak Seidov_, Feb 17 2005 *)
%o A036301 (Magma) [ n: n in [0..1300] | (#A eq 0 select 0 else &+A) eq (#B eq 0 select 0 else &+B) where A is [ d: d in D | IsOdd(d) ] where B is [ d: d in D | IsEven(d) ] where D is Intseq(n) ];
%o A036301 (PARI) select( is_A036301(n)=!vecsum(apply(t->(-1)^t*t,digits(n))), [0..1999]) \\ This defines the function is_A036301 = !A071650; the surrounding select(...) just serves as a check and illustration. - _M. F. Hasler_, Dec 09 2018
%o A036301 A36301=[112]; A036301(n, L=#A36301)={while(n>L, A36301=concat(A36301, next_A036301(A36301[L], L, L+=1))); A36301[n]} \\ _M. F. Hasler_, Aug 11 2023
%o A036301 next_A036301(N, L=#A36301, k=setsearch(A36301, N+1, 1)) = if(k>L, until( is_A036301(N+=1),); N, k, A36301[k], N+1) \\ next larger term: min { a(k) > N }. - _M. F. Hasler_, Aug 11 2023
%o A036301 (Python)
%o A036301 def eodiff(n):
%o A036301   digs = list(map(int, str(n)))
%o A036301   return abs(sum(d for d in digs if d%2==0)-sum(d for d in digs if d%2==1))
%o A036301 def aupto(lim): return [m for m in range(lim+1) if eodiff(m) == 0]
%o A036301 print(aupto(1298)) # _Michael S. Branicky_, Feb 21 2021
%Y A036301 Cf. A071650 (sum of odd digits minus sum of even digits).
%K A036301 nonn,base
%O A036301 1,2
%A A036301 _Patrick De Geest_, Dec 15 1998
%E A036301 Zero added by _Zak Seidov_, Nov 22 2010
%E A036301 Name edited by _Michel Marcus_, Jan 14 2021