On Thu, Nov 19, 2015 at 10:44 AM, Michael Greenwald <mbgreen@seas.upenn.edu> wrote:
On 2015-11-19 10:30, Eric Angelini wrote:
Hello Math-Funsters,
I was looking for a way to represent any fraction with one single integer. Do you know if there is a common way to do that or a paper about it?
Any method of showing that the rationals are countable implicitly has such a representation. There's a paper by ?? & Wilf on "counting the rationals", which, if I recall correctly, has an example of an explicit formula.
I think this is the sequence you're referring to. It has each nonnegative rational exactly once, and a(0) = 0, so define a(-n) = -a(n) and then encode the rational number as the integer index into a. https://oeis.org/A002487 -- Mike Stay - metaweta@gmail.com http://www.cs.auckland.ac.nz/~mike http://reperiendi.wordpress.com