A combination of numbers can be represented by literally listing the numbers, e.g. (1,2,3,4,6) or (1,2,3,4,5). An alternative way is to tell the combination's ordinal number in the list of all combinations of its size. E.g. the two combinations above are number 2 and number 1 respectively. The (6,8,9,10,11) and (7,8,9,10,11) are numbers 461 and 462, since they are the last two out of 5 from 11 and there are 462 of them all. For those in between, there is more than one way of how they can be ordered. Usually, the following two systems are used: a) relative ordering (the usual lexicographic order) b) absolute ordering (also called "combination sequence numbers" or CSN) To compare them, see how 4 of 7 are listed in each case:
Obviously, the relative ordinal numbers depend on the pool size (7 in this case). If the pool were bigger than 7, the combination number 5 would be (1,2,3,8) rather than (1,2,4,5). This is not the case with absolute ordinals, where all combinations of e.g. 5 numbers are listed before number 6 is added. Or not added, if pool is 5. Makes no difference for combinations before. So an absolute ordinal number and the pick (4 here) alone uniquely determine the combination. There are two separate cases in program Ininuga when ordinal numbers are calculated. To see the source code of the routines, used for this purpose, open: Pascal & Assembler: the optimized working version. (Compare comments in assembler with Pascal only version below.) Pascal only: included for documentation purpose, although working, but slower. - - - Link: To calculate relative ordinals (pool 30 and above) go to Martin Round's page - - - And here is an observation for anyone interested in calculating these numbers. There is a simple conversion between absolute and relative ordinals. Let's take combinations 4 from 9 for example. Top | Home | What are wheels | About Ininuga | Links | Free download | Ordinal numbers | Code tips |