OFFSET
1,1
COMMENTS
There are only terms with an even number of digits, and precisely, there exist A137233(2*k) terms with 2*k digits.
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.
The opposite conditions, an odd sum of digits, and an odd number of odd digits, are the same and are A054684.
FORMULA
EXAMPLE
26 is a term since 2+6 = 8 (even) and 26 has two even digits.
39 is a term since 3+9 = 12 (even) and 39 has zero even digits.
1012 is a term since 1+0+1+2 = 4 (even) and 1012 has two even digits.
MATHEMATICA
Select[Range[1000], EvenQ[Plus @@ IntegerDigits[#]] && EvenQ[Plus @@ DigitCount[#, 10, Range[0, 8, 2]]] &] (* Amiram Eldar, Nov 06 2022 *)
PROG
(Python)
def ok(n): s = str(n); return sum(map(int, s))%2 == sum(1 for d in s if d in "02468")%2 == 0
print([k for k in range(1031) if ok(k)]) # Michael S. Branicky, Nov 06 2022
(Python)
from itertools import count, islice, chain
def A358270_gen(): # generator of terms
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))))
(PARI) a(n) = n*=2; n += 100^logint(110*n, 100) \ 11; n - sumdigits(n)%2; \\ Kevin Ryde, Nov 10 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Bernard Schott, Nov 06 2022
STATUS
approved