I want to write mathematically a formula that checks the amount of the digit $0$ on even and on odd position of a given number $N$.
So for example $N=2000$ has $2$ zeros on odd position and $1$ zero on even. Or if $N=51601$ then $0$ zeros on odd position and $1$ zero on even.
How do I write this mathematically, I have no clue how to write a loop that checks every digit of a number of the size $n$? Something like this: $$O=\sum\limits_{\substack{pos = 0\\\ x=0}}^{pos = n} \mathbf{1}_{odd}\qquad \text{and}\qquad E=\sum\limits_{\substack{pos = 0\\\ x=0}}^{pos = n} \mathbf{1}_{even}$$
Where $x$ is the digit at position $pos$. And the variables $O$ stand for $\#$ odd zeros and $E$ for $\#$ of even zeros.
Thank you for help
Edit: It would be nice if it also works for a binary representation like $N=100101$