Combination Transversion Suppose we have a lottery, consisting of 5 balls. The range of balls is 1-39. In any given pick, there will be no duplicate values, and the order need not matter.
The upper limit of combinatorial possibilities is $$39!/((39-5)!*5!) = 575757$$
Say we want to assign an integer designation to each possible combination within this range of possibilities, where 1 will be the first combo, and 575757 will be the last possible combo.
So for instance, a pick of balls 1, 2, 3, 4, 5 could be combo 1.
In the middle, a pick of balls 5, 16, 22, 26, 29 could be combo 287878
And on the far end, a pick of balls 35, 36, 37, 38, 39 could be combo 575757.
Inversely, combo 1 could be converted back into balls 1, 2, 3, 4, 5... and so on.
How can these values be converted back and forth without resorting to sequential iteration, heavy recursion, or precomputing tables?
 A: If you'll pardon the programming language specificness of this answer, I believe I've found it.
http://msdn.microsoft.com/en-us/library/aa289166%28v=vs.71%29.aspx
The white paper for this algorithm is: "Algorithm 515: Generation of a Vector from the Lexicographical Index"; Buckles, B. P., and Lybanon, M. ACM Transactions on Mathematical Software, Vol. 3, No. 2, June 1977." 
I'd provide a link to the white paper, but have not been able to find the paper freely available.
A: I dont think you can do this in an easy way because this end in power series and diophantine equations way more complex than last Fermat theorem (if you want to avoid some recursive solution). As Droogendijk said you can create a database with the relations, this is the best approach if you persist on enumerate these list from 1 to 575757.
Another approach that involve  little algorithm is represent the list with numbers (not continuous numbers) with base 35. From here you can easily transform one to the other.
Generally any problems than rely in combinations instead of permutations becomes really hard to compute (as the partition of a number).
