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.

A358270 Numbers whose sum of digits is even and that have an even number of even digits.

This page as a plain text file.
%I A358270 #48 Nov 12 2022 02:10:16
%S A358270 11,13,15,17,19,20,22,24,26,28,31,33,35,37,39,40,42,44,46,48,51,53,55,
%T A358270 57,59,60,62,64,66,68,71,73,75,77,79,80,82,84,86,88,91,93,95,97,99,
%U A358270 1001,1003,1005,1007,1009,1010,1012,1014,1016,1018,1021,1023,1025,1027,1029,1030
%N A358270 Numbers whose sum of digits is even and that have an even number of even digits.
%C A358270 There are only terms with an even number of digits, and precisely, there exist A137233(2*k) terms with 2*k digits.
%C A358270 The conditions separately are A054683 for even sum of digits, and A356929 for even number of even digits, so that this sequence is their intersection.
%C A358270 The opposite conditions, an odd sum of digits, and an odd number of odd digits, are the same and are A054684.
%F A358270 a(n) = t - A179081(t) where t = A001637(2*n). - _Kevin Ryde_, Nov 10 2022
%e A358270 26 is a term since 2+6 = 8 (even) and 26 has two even digits.
%e A358270 39 is a term since 3+9 = 12 (even) and 39 has zero even digits.
%e A358270 1012 is a term since 1+0+1+2 = 4 (even) and 1012 has two even digits.
%t A358270 Select[Range[1000], EvenQ[Plus @@ IntegerDigits[#]] && EvenQ[Plus @@ DigitCount[#, 10, Range[0, 8, 2]]] &] (* _Amiram Eldar_, Nov 06 2022 *)
%o A358270 (Python)
%o A358270 def ok(n): s = str(n); return sum(map(int, s))%2 == sum(1 for d in s if d in "02468")%2 == 0
%o A358270 print([k for k in range(1031) if ok(k)]) # _Michael S. Branicky_, Nov 06 2022
%o A358270 (Python)
%o A358270 from itertools import count, islice, chain
%o A358270 def A358270_gen(): # generator of terms
%o A358270     return filter(lambda n:not (len(s:=str(n))&1 or sum(int(d) for d in s)&1), chain.from_iterable((range(10**l,10**(l+1)) for l in count(1,2))))
%o A358270 A358270_list = list(islice(A358270_gen(),61)) # _Chai Wah Wu_, Nov 11 2022
%o A358270 (PARI) a(n) = n*=2; n += 100^logint(110*n,100) \ 11; n - sumdigits(n)%2; \\ _Kevin Ryde_, Nov 10 2022
%Y A358270 Intersection of A054683 and A356929.
%Y A358270 Cf. A001637 (even length), A179081 (digit sum mod 2).
%Y A358270 Cf. A014263, A054684, A137233.
%K A358270 nonn,base,easy
%O A358270 1,1
%A A358270 _Bernard Schott_, Nov 06 2022