I'm working on a coding project and I have a 5-dimensional vector $\mathbf{v} \in \mathbb{N}^5$ that I need to map (in a **unique** fashion) to RGB colorspace (so, essentially I just want to map $\mathbf{v}$ to some $\mathbf{r} \in $ $\mathbb{N}^3$).

I've been able to find Cantor's Pairing Function, which was quite useful for a different purpose I had but doesn't seem to be of use here. So, my question does there exist such an injection from $\mathbb{N}^5 \mapsto \mathbb{N}^3$?

## Best Answer

EDIT:In case you're interested, for $k$ a natural, $|\mathbb N^k|= |\mathbb N | $ Using Schroeder-Bernstein, which states that sets $A$ and $B$ have the same cardinality iff there is an injection from $A$ to $B$ and an injection from $B$ to $A$ . You have an obvious injection in one side (e.g.,$n \rightarrow (n,0,...,0)$ ) , and in the opposite direction : Select different primes $p_1, p_2,..,p_k $ and map $$ (n_1,n_2,..,n_k) \rightarrow p_1^{n_1}p_2^{n_2}..p_k^{n_k} $$