If we order all the partitions of a integer in a lexicographic order, how can we compute the position of each partition in this order without having to explicitly list all other partitions that precedes it. How is the modification done when we restrict the maximum part and the number of partitions? I would like to use these indices in database search. It would be helpful even if we get a closed form formula when the number of parts is restricted to small number, for example $<15$ and the integer is $< 100$ with each part $<5$.
Lexicographic order seems more complex than reverse lexicographic order.
Maybe one possibility is to multiply each partition in lexicographic order by the number that represents its position in the sequence. Storing the partitions this way you retrieve the order by dividing the partition stored value by the original integer to partition. And you retrieve the correct partition terms by dividing them by the order. I dont know what the data model is, but of course somehow, together with the series of each "new transformed partition" you would also have to store the original value of the integer to partition, to compare with.
i'm not sure if the general answer is in this paper Algorithm 515: Generation of a Vector from the Lexicographical Index (as i havent read it, not available online), but it gives the algorithm for combinations, i.e from combination to index and index to combination.
In Knuth's The Art Of Computer Programming (TAOCP), Semi-numerical Algorithms also has examples and references of such algorithms (as mentioned in comment).
In general combinatorics this is called ranking and unranking (as mentioned in comment).
Given the fact that the items of a combinatorial sequence are lexicographicaly ordered and the fact that one can (efficiently) count the combinatorial items up to $N$.
The general algorithm to find the index of any combinatorial object in lexicographic order would be (rough outline):
In other words the most general algorithm for ranking (ordered) combinatorial objects (computing the index in the order given the combinatorial object), although not necessarily efficient, is:
Of course the previous algorithm is based on the fact that there is a lexicographic order and the counting of combinatorial items (e.g combinations, permutations, partitions etc..) is efficient (which is not always the case).
Especially note that partitions are easier to generate in reverse lexicographic order (i.e descending). A PhD thesis on encoding partitions as lexicographicaly ascending (instead of descending) and the reference FAST ALGORITHMS FOR GENERATING INTEGER PARTITIONS, ANTOINE ZOGHBIU and IVAN STOJMENOVIC, 1998