Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If anyone's curious on how it is possible to list all the rational numbers, it would go something like this:

0, 1, -1, 2, -2, 1/2, -1/2, 3, -3, 1/3, -1/3, 2/3, -2/3, 3/2, -3/2, 4 ...

at each step you list the numbers where the numerator and denominator are <= x. For example, if x = 2, we can count 1, -1, 2, -2, 1/2, and -1/2. Obviously it is an infinite list, but you can list them.



My favorite way to visualize the bijection is https://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: