I was trying to find the rank difference between two permutations with repetitions and which has only digits. More over I need to find the sum of all the permutations between them. I figured out that the first part can be solved by extending the general permutation ranking without repetitions.
Now regarding the second issue, I can directly find each permutation and get the sum if the number of digits were small. But, the number of digits in the permutation can be at most 500!!, making my solution non-feasible. Any insights on how to find the sum??