I'm trying to find a function that can convert each number (I mean natural numbers) in the range M..N
to another number in the same range. Later I need to convert it back.
Let's take the 0..99
range for example. A very easy solution is:
b = 99 - a
later to find a
from b
: a = 99 - b
. And we can be sure that a
and b
will be in the 0..99
range.
What I want is the following If I convert all numbers from the linear series 0,1,2,3,4..99
with the function above I get 99, 98, 97, 96, 95..0
, which is another linear one.
I would like to convert 0..99
to a non-linear series, but remaining in the same range.
Something like: 0 -> 11; 1 -> 52; 2 -> 77; etc. and later convert these numbers back.
Is there a mathematical function that can do this?
EDIT The function can be also an algorithm containing conditions, loops, etc. I will implement this in a programming language.