$|\mathbb N^{\mathbb N}| = |2^\mathbb N|$ by finding a bijection I was trying to find a direct proof that $|\mathbb N^{\mathbb N}| = |2^\mathbb N|$, by finding a bijection between the two sets. The idea that came to mind was to start with the sequence of natural numbers. Each natural number would be 'translated' in a sequence of zeroes of the length given by the natural number. A  1 would be added to the sequence obtained, and all the 01 sequences thus obtained would be concatenated in the order dictated by the original sequence of naturals. However, this would run into problems, since all complete 01 sequences thus obtained would end on 1, so that the function from $\mathbb N^{\mathbb N}$ to $2^\mathbb N$ would not be surjective.
I turned to Stack Exchange for advice and found out that the post Cardinality of the set of all natural sequences is $2^{\aleph_0}$ contained the same solution, except that ones were switched for zeroes and vice versa. Of course, this could not work either: all 01 sequences obtained end on 0.
As a workaround to the problem, I would propose the function as described above, except that the last natural number in the original series would now be translated in its binary form, and no 0 or 1 added. I think that would result in a bijection. Could that be right? Would there be other possibilities?
Edit: I am now convinced that the approach I proposed cannot work either. The function is not injective. At first I thought that the last part of the 01 sequence corresponding to the last natural number of the original sequence would be identifiable by its starting with 11 (one 1 stemming from the previous number, the other from the binary form of the last natural in the sequence - except when that would be 0). I now realize that 11 may occur within the binary form itself.
Therefore, still at a loss...

I am thinking of this mapping:
for $A = (a_1,a_2,\cdots,a_n,\cdots) \in \mathbb{N}^\mathbb{N}$,
1) if $a_1 > 0$, then map $A$ to:
$$ (a_1 \mbox{ copies of } 1, \, a_2 \mbox{ copies of } 0, \, \cdots , a_n \mbox{ copies of } (n \mod 2), \,), \cdots$$
2) if $a_1 = 0$, and there exists a $k \in \mathbb{N}$ such that $a_k > 0$, then (suppose $k$ be the first one) map $A$ to:
$$ (k-1 \mbox{ copies of } 0, \,a_k \mbox{ copies of } 1, \, a_{k+1} \mbox{ copies of } 0, \, \cdots , a_{k+n-1} \mbox{ copies of } (n \mod 2), \,), \cdots$$
3) map $(0,0,\cdots)$ to itself.
It seems to be a bijection.
