1. 5
    1. 2

      Very cool independent derivation of this trick. I first learned about it via factorial bases; I think that you’ve found Lehmer coding.

      1. 1

        Thank you for linking these! I didn’t think that came up with this first, but I couldn’t figure out how to search for preexisting solutions. Lehmer code looks great. Cheers.