The ranking and unranking problem of a Gray code \(C(n,k)\) for compositions of \(n\) into \(k\) parts is solved. This means that rules have been derived by which one can calculate in a non-recursive way the index of a given codeword, and vice versa, determine the codeword with a given index. A number system in terms of binomial coefficients is presented to formulate these rules.
1970-2025 CP (Manitoba, Canada) unless otherwise stated.