Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Combinatorial number system

From Wikipedia, the free encyclopedia
Numbering of combinations of items
The(53)=10{\displaystyle {\tbinom {5}{3}}=10} rows of this matrix are the3-combinations of{0...4}{\displaystyle \{0...4\}}. Whenn{\displaystyle {\color {Red}n}} is thek{\displaystyle {\color {Green}k}}-th element of the combination, the "digit" is(nk){\displaystyle {\tbinom {\color {Red}n}{\color {Green}k}}}.
The last 3-combination of{0...9}{\displaystyle \{0...9\}} has number(71)+(82)+(93)=119{\displaystyle {\tbinom {\color {Red}7}{\color {Green}1}}+{\tbinom {\color {Red}8}{\color {Green}2}}+{\tbinom {\color {Red}9}{\color {Green}3}}=119}, which is(103)1{\displaystyle {\tbinom {10}{3}}-1}.
{0,3,4,6,9} and {0,1,3,7,9}
Ernesto Pascal (1887): An integerN{\displaystyle N} has a unique expression ask=1n(xkk){\displaystyle \sum _{k=1}^{n}{\binom {x_{k}}{k}}} with increasingxk{\displaystyle x_{k}}.

Inmathematics, and in particular incombinatorics, thecombinatorial number system of degreek (for some positiveintegerk), also referred to ascombinadics, or theMacaulay representation of an integer, is a correspondence betweennatural numbers (taken to include 0)N andk-combinations. The combinations are represented asstrictly decreasingsequencesck > ... > c2 > c1 ≥ 0 where eachci corresponds to the index of a chosen element in a givenk-combination. Distinct numbers correspond to distinctk-combinations, and produce them inlexicographic order. The numbers less than(nk){\displaystyle {\tbinom {n}{k}}} correspond to allk-combinations of{0, 1, ...,n − 1}. The correspondence does not depend on the size n of the set that thek-combinations are taken from, so it can be interpreted as a map fromN to thek-combinations taken fromN; in this view the correspondence is abijection.

The numberN corresponding to (ck, ...,c2,c1) is given by

N=(ckk)++(c22)+(c11){\displaystyle N={\binom {c_{k}}{k}}+\cdots +{\binom {c_{2}}{2}}+{\binom {c_{1}}{1}}}.

The fact that a combination corresponds to a non-negative integer was observed byLehmer (1964).[1] Indeed, agreedy algorithm finds thek-combination corresponding toN: takeck maximal with(ckk)N{\displaystyle {\tbinom {c_{k}}{k}}\leq N}, then takeck−1 maximal with(ck1k1)N(ckk){\displaystyle {\tbinom {c_{k-1}}{k-1}}\leq N-{\tbinom {c_{k}}{k}}}, and so forth. Finding the numberN, using the formula above, from thek-combination (ck, ...,c2,c1) is also known as "ranking", and the opposite operation (given by the greedy algorithm) as "unranking"; the operations are known by these names in mostcomputer algebra systems, and incomputational mathematics.[2][3]

The term "combinatorial representation of integers" was shortened to "combinatorial number system" byKnuth (2011).[4]He also referencesErnesto Pascal (1887).[5]The term "combinadic" is introduced by James McCaffrey.[6]

Unlike thefactorial number system, the combinatorial number system of degreek is not amixed radix system: the part(cii){\displaystyle {\tbinom {c_{i}}{i}}} of the numberN represented by a "digit"ci is not obtained from it by simply multiplying by a place value.

The main application of the combinatorial number system is that it allows rapid computation of thek-combination that is at a given position in the lexicographic ordering, without having to explicitly list thek-combinations preceding it; this allows for instance random generation ofk-combinations of a given set.Enumeration ofk-combinations has many applications, among which aresoftware testing,sampling,quality control, and the analysis oflottery games.

Ordering combinations

[edit]

Ak-combination of a setS is asubset ofS withk (distinct) elements. The main purpose of the combinatorial number system is to provide a representation, each by a single number, of all(nk){\displaystyle {\tbinom {n}{k}}} possiblek-combinations of a setS ofn elements. Choosing, for anyn,{0, 1, ...,n − 1} as such a set, it can be arranged that the representation of a givenk-combinationC is independent of the value ofn (althoughn must of course be sufficiently large); in other words consideringC as a subset of a larger set by increasingn will not change the number that represents C. Thus for the combinatorial number system one just considersC as ak-combination of the setN of all natural numbers, without explicitly mentioningn.

In order to ensure that the numbers representing thek-combinations of{0, 1, ...,n − 1} are less than those representingk-combinations not contained in{0, 1, ...,n − 1}, thek-combinations must be ordered in such a way that their largest elements are compared first. The most natural ordering that has this property islexicographic ordering of thedecreasing sequence of their elements. So comparing the 5-combinationsC = {0,3,4,6,9} andC′ = {0,1,3,7,9}, one has thatC comes beforeC′, since they have the same largest part 9, but the next largest part 6 ofC is less than the next largest part 7 ofC′; the sequences compared lexicographically are (9,6,4,3,0) and (9,7,3,1,0).

Another way to describe this ordering is view combinations as describing thek raised bits in thebinary representation of a number, so thatC = {c1, ...,ck} describes the number

2c1+2c2++2ck{\displaystyle 2^{c_{1}}+2^{c_{2}}+\cdots +2^{c_{k}}}

(this associates distinct numbers toall finite sets of natural numbers); then comparison ofk-combinations can be done by comparing the associated binary numbers. In the exampleC andC′ correspond to numbers 10010110012 = 60110 and 10100010112 = 65110, which again shows thatC comes beforeC′. This number is not however the one one wants to represent thek-combination with, since many binary numbers have a number of raised bits different fromk; one wants to find the relative position ofC in the ordered list of (only)k-combinations.

Place of a combination in the ordering

[edit]

The number associated in the combinatorial number system of degreek to ak-combinationC is the number ofk-combinations strictly less thanC in the given ordering. This number can be computed fromC = {ck, ...,c2,c1} withck > ... >c2 >c1 as follows.

From the definition of the ordering it follows that for eachk-combinationS strictly less than C, there is a unique index i such thatci is absent fromS, whileck, ...,ci+1 are present inS, and no other value larger thanci is. One can therefore group thosek-combinationsS according to the possible values 1, 2, ...,k ofi, and count each group separately. For a given value ofi one must includeck, ...,ci+1 inS, and the remainingi elements ofS must be chosen from theci non-negative integers strictly less thanci; moreover any such choice will result in ak-combinationsS strictly less than C. The number of possible choices is(cii){\displaystyle {\tbinom {c_{i}}{i}}}, which is therefore the number of combinations in groupi; the total number ofk-combinations strictly less thanC then is

(c11)+(c22)++(ckk),{\displaystyle {\binom {c_{1}}{1}}+{\binom {c_{2}}{2}}+\cdots +{\binom {c_{k}}{k}},}

and this is the index (starting from 0) ofC in the ordered list ofk-combinations.

Obviously there is for everyN ∈ N exactly onek-combination at index N in the list (supposingk ≥ 1, since the list is then infinite), so the above argument proves that everyN can be written in exactly one way as a sum ofk binomial coefficients of the given form.

Finding thek-combination for a given number

[edit]

The given formula allows finding the place in the lexicographic ordering of a givenk-combination immediately. The reverse process of finding thek-combination at a given placeN requires somewhat more work, but is straightforward nonetheless. By the definition of the lexicographic ordering, twok-combinations that differ in their largest elementck will be ordered according to the comparison of those largest elements, from which it follows that all combinations with a fixed value of their largest element are contiguous in the list. Moreover the smallest combination withck as the largest element is(ckk){\displaystyle {\tbinom {c_{k}}{k}}}, and it hasci = i − 1 for alli < k (for this combination all terms in the expression except(ckk){\displaystyle {\tbinom {c_{k}}{k}}} are zero). Thereforeck is the largest number such that(ckk)N{\displaystyle {\tbinom {c_{k}}{k}}\leq N}. Ifk > 1 the remaining elements of thek-combination form thek − 1-combination corresponding to the numberN(ckk){\displaystyle N-{\tbinom {c_{k}}{k}}} in the combinatorial number system of degreek − 1, and can therefore be found by continuing in the same way forN(ckk){\displaystyle N-{\tbinom {c_{k}}{k}}} andk − 1 instead ofN andk.

Example

[edit]

Suppose one wants to determine the 5-combination at position 72. The successive values of(n5){\displaystyle {\tbinom {n}{5}}} forn = 4, 5, 6, ... are 0, 1, 6, 21, 56, 126, 252, ..., of which the largest one not exceeding 72 is 56, forn = 8. Thereforec5 = 8, and the remaining elements form the4-combination at position72 − 56 = 16. The successive values of(n4){\displaystyle {\tbinom {n}{4}}} forn = 3, 4, 5, ... are 0, 1, 5, 15, 35, ..., of which the largest one not exceeding 16 is 15, forn = 6, soc4 = 6. Continuing similarly to search for a 3-combination at position16 − 15 = 1 one findsc3 = 3, which uses up the final unit; this establishes72=(85)+(64)+(33){\displaystyle 72={\tbinom {8}{5}}+{\tbinom {6}{4}}+{\tbinom {3}{3}}}, and the remaining valuesci will be the maximal ones with(cii)=0{\displaystyle {\tbinom {c_{i}}{i}}=0}, namelyci =i − 1. Thus we have found the 5-combination{8, 6, 3, 1, 0}.

National Lottery example

[edit]

For each of the(496){\displaystyle {\binom {49}{6}}} lottery combinationsc1 < c2 < c3 < c4 < c5 < c6 , there is a list numberN between 0 and(496)1{\displaystyle {\binom {49}{6}}-1} which can be found by adding

(49c16)+(49c25)+(49c34)+(49c43)+(49c52)+(49c61).{\displaystyle {\binom {49-c_{1}}{6}}+{\binom {49-c_{2}}{5}}+{\binom {49-c_{3}}{4}}+{\binom {49-c_{4}}{3}}+{\binom {49-c_{5}}{2}}+{\binom {49-c_{6}}{1}}.}

See also

[edit]

References

[edit]
  1. ^Applied Combinatorial Mathematics, Ed. E. F. Beckenbach (1964), pp.27−30.
  2. ^Generating Elementary Combinatorial Objects, Lucia Moura, U. Ottawa, Fall 2009
  3. ^"Combinations — Sage 9.4 Reference Manual: Combinatorics".
  4. ^Knuth, D. E. (2005), "Generating All Combinations and Partitions",The Art of Computer Programming, vol. 4, Fascicle 3, Addison-Wesley, pp. 5−6,ISBN 0-201-85394-9.
  5. ^Pascal, Ernesto (1887),Giornale di Matematiche, vol. 25, pp. 45−49
  6. ^McCaffrey, James (2004),Generating the mth Lexicographical Element of a Mathematical Combination, Microsoft Developer Network

Further reading

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Combinatorial_number_system&oldid=1320121446"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp