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$
You should introduce and define your own notation.
Let $n$ be written as a base $10$ numeral as $d_k \ldots d_0$, where every $d_i \in \{ 0..9\}$ and $d_k \neq 0$. Then you can write $d_i(n)$ to denote the $i$th digit of $n$ and define e.g. the set of even positions of $n$ for which the digit at the position is $0$:
$$E_{0}(n) = \{ i \mid \exists j. d_{2j}(n) = 0 \}$$