Bijection between $\{0,1\}^\omega$ and the set of positive integers

Solution 1:

$f(x)$ is defined only when $x$ has a finite number of $1$s. Indeed, the set $$\bigcup_{n=1}^\infty\{0,1\}^n\times \{0\}^\omega=\{x\in \{0,1\}^\omega: x_i=0\text{ for } i\text{ sufficiently large}\}$$ is countable with $f$ as a bijection to $\mathbb{Z}^+$. However, you'll notice that when $x$ has infinitely many $1$s, then $f(x)=\infty \not\in \mathbb{Z}^+$.