Problem: We all know the simple bijection $\phi: \{0,\ldots,2^{n}-1\} \rightarrow \{0,1\}^n$ by just using binary numbers.
However, is there a bijection $\psi: \{0,\ldots,2^{n}-1\} \rightarrow \{0,1\}^n$ such that $|\psi(i+1)-\psi(i)|^2 \leq 2$ for all $i \in \{0,\ldots,2^{n}-2\}$? Namely a bijection where you never change more than $2$ "bits"?
My approach: After thinking a bit I have the idea that you can proove this by sorting all $\{0,1\}^n$ tuples by the amount of ones that occur and then use this to define your bijection, you would just have to show that it cannot be that there are "jumps" in the sorted list of more than 2 changed bits. However, I am also interested in a concrete definition that could be algorithmically implemented and not just a theoretical approach, namely you need to know which bits to change when you increment your number.
Note: $\{0,1\}^n$ means a tuple of length $n$ with entries $0$ or $1$.