Is there any other bijection from $\mathbb{N}^{2}$ to $\mathbb{N}$ other than the pairing function? My search so far has come up empty.
Asked
Active
Viewed 245 times
0
-
1There are $2^\omega=\mathfrak c$ such bijections. Are you asking for explicit examples different from the Cantor pairing function $\pi$? One easy one is given by $\pi'(m,n)=\pi(n,m)$. – Brian M. Scott Mar 25 '20 at 16:32
-
One common trick is to use the fundamental theorem of arithmetic. The map $(i,j) \mapsto 2^i 3^j$ is an injection $\mathbb{N}^2 \rightarrow \mathbb{N}$; then map the $i$th element of this image to the $i$th element of $\mathbb{N}$ to get a bijection. – Jair Taylor Mar 25 '20 at 16:33
-
I don't know what this pairing function that we have to avoid is, but try composing it with any nontrivial permutation of $\Bbb{N}$ on the left, or $\Bbb{N}^2$ on the right, and you can guarantee a bijection different from the one you started with. – user759562 Mar 25 '20 at 16:33
-
I assumed the OP just wants, informally, a different approach to this problem. – Jair Taylor Mar 25 '20 at 16:35
-
@user759562: Presumably the Cantor pairing function. – Brian M. Scott Mar 25 '20 at 16:38
1 Answers
2
Yes. Here's an example. Let$$S=\{2^a3^b\mid a,b\in\mathbb N\}=\{6,12,18,\ldots\}.$$There is a bijection $\beta\colon\mathbb N\longrightarrow S$: just define $\beta(n)$ as the $n$th element of $S$. And there is a bijection $\varphi\colon\mathbb N^2\longrightarrow S$: $\varphi(a,b)=2^a3^b$. Now take $\varphi^{-1}\circ\beta$.
José Carlos Santos
- 427,504
-
1
-
1
-
@AsafKaragila I personally really like this one! It combines two basic ideas: recursive constructions (when we unfold $b$, that's what it is) and coding via prime factorization. Additionally it takes basically no effort to verify that it works (unlike Cantor's). It's also a good exercise to show that this is computable without using Church's thesis (whereas for the Cantor pairing function this follows immediately from the computability of basic algebraic operations). – Noah Schweber Mar 25 '20 at 17:06
-
-
@Noah: Well, then what is the number which is mapped to $(42,65)$? Can you find that answer is under a minute without using a piece of paper and/or a computer? – Asaf Karagila Mar 25 '20 at 17:20
-
@AsafKaragila No, but why should I? To me ease of calculation doesn't count for much. – Noah Schweber Mar 25 '20 at 17:24
-
I like this answer, but I admit Asaf's suggestion $\pi(n,m)=2^n(2m+1)-1$ (from the other question that this is a duplicate of) is much prettier. (although I still probably could not compute $\pi(42, 65)$ in under a minute without any aids...) – Jair Taylor Mar 25 '20 at 18:34
-
@JairTaylor Actually, that's my favourite bijection between $\mathbb N^2$ and $\mathbb N$. – José Carlos Santos Mar 25 '20 at 18:40
-
I got mixed up for a second there. I propose you rename the variables, so people don't get confused by the double use of $b$. Or, alternatively, rename the bijection. Moreover, you could also say $n$th largest, since you implicitly use an ordering on the set $S$. – Nikolaj-K May 16 '20 at 12:58
-
1@Nikolaj-K I've changed the name of my map from $b$ to $\beta$. – José Carlos Santos May 16 '20 at 13:41