How can we compute an index for a given combination of the n integers {1,2,3,...,n} taken k at a time? Also, given such an index, how can we recover the particular combination that has that index?
It turns out that there is a relatively easy-to-compute expression for the index of such a combination and there's a pretty efficient procedure to recover it, given its index.
Originally written on December 5, 2019.
I'm sharing this work under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. See the LICENSE file for more information.