If efficiently calculating this mapping is of interest, see also http://www.thelowlyprogrammer.com/2010/04/indexing-and-enume... .
(Python isn't my usual language these days, but this is a great example where the seamless bigint support shines. The number of possible sets grows fast!)