Given the numbers 0 thru n, if you use the First R Prime numbers, and mod them, Just so long as N < the Multple of the first R prime numbers, then you will end up with a unique numerical sequence that represents each such number.
ie..: Referencing the primes 2,3,and 5, the numbers 0 thru 7 could be seen as:
i am gonna do an example, you can generalize. let the primes be p,q,r
n=p*q*a1+p*r*a2+q*r*a3 (mod p*q*r)
and n=r1 (mod p), r2 (mod q) r3 (mod r)
hence we want to solve for r1,r2,r3
we have n=r1 (mod p)
so q*r*a3=r1 (mod p)
hence, introduce a variable x
q*r*a3=r1+p*x
which is linear diophantine equation in (x,a3) which can be solved easily by extended euclidean algorithm.
similarly you can find a2,a1
finally you have n
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!