Imagine we have a formula that is supposed to create a rational number out of two given numbers:
uint8_t x;
uint8_t y;
Here x and y are two 8-bit numbers that are limited between 0 to 255.
If I create a formula such as x/(y+1) to create rational numbers out of them, there are many repetitive rational numbers such as 10/5 and 6/3 that are waste. They are just equal to 2/1 (x=2, y=0). I am not interested in them. On the other hand, I am not interested in making a lookup table either. I need a function that produces such rational numbers in a reasonable size (mathematicians can argue what does reasonable mean).
I am also interested in the formula results just in the range of (0,2].
Dose discrete math have any solution for creating the formula to give the maximum number of unique rational numbers within range of (0,2] out of two 8-bit numbers?
How about $2\cdot\frac{256x+y+1}{256^2}$?