# Lotto Software to Calculate the Combination Lexicographical Order (CSN) or Indexes of Lottery Drawings

## By Ion Saliu, Founder of Lotto Combinatorial Mathematics

• FORMULA ~ version 8.1, April 22, 2003 ~ Retired 16-bit scientific software.
• SuperFormula ~ version 13.0, October 13, 2007 ~ 32-bit software, supersedes FORMULA
~ Powerful and comprehensive software for mathematics, probability theory, statistics, formulas, algorithms.
• COLORDER ~ version 2.0, December 2002.
~ Find the lexicographical index of a lotto combination (CSN) and vice-versa: The lotto combination for a given rank. Applicable to all lotto game formats, including Powerball, Mega Millions, Euromillions, and Keno.
• DrawIndex ~ version 5.0, December 2010.
~ The program opens a lotto data file (past drawings) and calculates the combination lexicographical order (CSN or LON) for every lottery drawing in the specified range. The rank, or index, or lexicographical order is written to a new file, next to the corresponding lotto draw.
• SORTING ~ version 13.0, September 2008.
~ Lottery, lotto software sorts the combinations in ascending order. It handles lotto-4, lotto-5, lotto-6, lotto-7, Powerball / Mega Millions (5+1), Euromillions (5+2), Quinto 5-digit lottery. It formats also the pick-3, pick-4 lotteries and horse racing (trifecta) data files.
• Combinations ~ version 8.0, December 2010.
~ The most comprehensive lotto software generator generates combinations for absolutely any type of lotto game, plus horseracing straight sets. The lotto combinations can have skips (constant gaps) between them. Furthermore, this incredible lottery program even generates lotto combinations within a range of numbers and also between two lexicographic indexes or ranks.

Here is a neat lotto program to round up the combination lexicographical order task: DrawIndex. My previous lotto software calculated the combination lexicographical order one combination at a time. The user enters the numbers in the combination one by one. The software calculates the lotto combination index, or rank, or order, or CSN (combination sequence number) instantly. The result is displayed on screen and also saved to a disk file.

No doubt, everybody wanted automated procedures. I heard the message. Lottery players have past drawings (results) saved in text files. They wanted lotto software to open the draws file, take each draw and calculate its combination lexicographical order and write it next to the lottery drawing, in the same line. Each lotto combination must be sorted in ascending order. You can use my free lottery program SORTING to correctly sort the lottery drawings (results) files for lotto and Powerball / Mega Millions / Euromillions games.

Here is a real-life report for the 5 from 53 AND 1 from 42 Powerball lottery game played in the United States.

```                   PowerBall '5+1' Draw Lexicographical Order
File: C:\LOTTERY\Powerball\PAPB-53
Game Type: 53 / 5 / 42
Total Combinations: 120,526,770

Line      D R A W           Lexicograhical
no.                             Order
1:   1 20 25 40 53  19      9,510,919
2:  15 16 19 21 49   5     96,398,951
3:  14 21 22 29 44   3     94,633,857
4:  32 33 35 40 51   1    119,430,949
5:  18 23 31 38 50  20    105,671,978
...
12:   4 18 20 25 42  29     37,993,019
13:   8 11 24 31 37  41     64,347,989
14:  23 26 46 49 52  28    113,802,640
15:   9 10 38 42 43   5     69,709,337
```

The drawing #4 in the data file consists of the following regular numbers:
32 33 35 40 51
plus the power ball: 1
The lexicographical order of the combination in the 5/53 & 1/42 PowerBall game is: 119,430,949.

As expected, the lotto combination indexes or lexicographic ranks follow the normal distribution or Gauss curve. They are highly concentrated around the FFG median. I detailed the topic in a previous thread of messages:

• FFG Median, Filtering, Probability, Jackpot.
• Dynamic vs Static in Lotto Analysis.

Some lottery players will certainly wait for wacky situations: Lexicographical indexes at the extremes of the Gauss curve. Perhaps a situation such as the following Cash-5 combination lexicographical order report. It is a 39-5-number lotto game played in Pennsylvania lottery (superseded by a 5 from 43 lotto game):

```                   Lotto-5 Draw Lexicographical Order
File: \Lottery\Lotto5\PA-5
Game Type: 39 / 5
Total Combinations: 575,757

Line      D R A W       Lexicograhical
no.                        Order
49:   2 14 21 30 37     126,356
50:  12 15 18 28 36     483,013
51:   1  2  3  9 22         178 *
52:   4 18 28 31 38     244,946
53:   4 18 20 24 28     244,055
```

Past draw #51: LON (combination sequence number) = 178. Perhaps a lottery strategy would have played only the lotto combinations with indexes in the range 101 to 199. Of course, you'll find the right lotto software right here: Combinations. It is undoubtedly the most comprehensive lottery software that generates lotto combinations. Among other features, the powerful program generates lotto combinations between two lexicographical ranks (or lexicographic indexes, or combination sequence numbers CSN).

There are many more new visitors to my site compared to old timers. I am aware that some visitors have problems with basic tasks such as creating the lottery data files. Be aware that just about everything is covered here. This Web site has a huge volume of information — probably 1000 pages of a standard-size book. Take your time and read as much as you can. Use the search engine to find answers to your problems. The lottery data files are presented in detail on several Web pages at this site.

You may not be able to use DrawIndex if your lottery draws files are not in the correct format. I recommend you use another free program I offer here: PARSEL. It can help you find and fix many errors in your lotto files.
Your lotto-5 data file is most likely in the correct format if it looks like the middle block (DRAW) in the above real-life example.

A numerologist with the meaningful pen name Serendipity discovered a serious bug in CoLOrder v1.0. The Powerball / Mega Millions routine was no longer correct for the new American game format 53/5/42. The same erratic results were reported by the Powerball modules of Draw Index v1.0. I had a hard time finding the bugs. The algorithm was correct. The problem was the data type used by the 16-bit compiler.

I reconfigured all data types to accommodate the largest possible lotto game formats. I recompiled for 32-bit Windows. That is, the underlying DOS 7 (known lately as Command Prompt) accepts large numeric types. The new formatting of huge lotto / Keno numbers is now easier to read. For example: Total possible combinations for Keno 80/20 is no longer expressed in scientific notation. The huge number can be read something like billions of billions: 3,535,316,142,212,174,320.

Axiomatic one, the Draw Index lotto software has been greatly upgraded. The program shows now the movement of the drawing indexes (ranks); i.e. increase or decrease from the previous draw, including as percentages.

```            Lotto-6 Draw Lexicographical Order
Game Type: 6 of 49
Total Combinations in the Game: 13,983,816

Draw     D R A W I N G      Lexicographical   Difference From  % Difference /
no.                            Order          Previous Draw    Total Combos

1    5 22 24 28 29 44        6829859           -654656          -4.68%
2    6 13 20 25 36 47        7484515            657821           4.7 %
3    5 22 23 24 36 37        6826694            247871           1.77%
4    5 14 21 31 43 46        6578823          -5898828         -42.18%
5   15 19 22 29 38 39       12477651          10535635          75.34%
6    2  4 10 38 39 42        1942016           -361055          -2.58%
7    2  7  9 30 32 40        2303071          -3730665         -26.68%
8    5  7 17 19 23 34        6033736           -202150          -1.45%
9    5  9 19 21 30 31        6235886           1598448          11.43%
10    4  5  7 21 35 36        4637438           2428896          17.37%
....
```

Evidently, in this particular case of 6/49 lotto, the most frequent lexico indexes start with (0)6; i.e. 6 million up to, but not including, 7 million. For example, 6829859, 6033736, 6999999. Such combination ranks reside in the middle zone of the bell curve.

• PermuteCombine, the universal permutations, arrangements and combinations generator for any numbers and words;
• LexicographicSets, the universal permutations, arrangements and combinations lexicographic indexing (ranking);
• Combinations, the universal combinations generator for any lotto, Keno, Powerball game: N numbers taken M at a time, in K steps;
• WRITER, random generator of letters to words, passwords, sentences;
• NthIndex ~ lexicographic indexing superseded by LexicographicSets;
• SEQUENCE ~ lexicographic indexing superseded by LexicographicSets;
• COLORDER - lexicographical indexing for lotto and Powerball only;
• DrawIndex - highly automated lexicographical indexing for lotto draw files.

See also: Online Odds, Probability Calculator & Random Numbers Combinations Generator: Lotto, Powerball, Lottery, Horse Races, Roulette, Sports Betting, Soccer, Pools, 1X2; The best that ever was!

## Resources in Theory of Probability, Mathematics, Combinatorics, Lexicographic Order, Software

See a comprehensive directory of the pages and materials on the subject of theory of probability, mathematics, lexicographical order, combinatorics, plus software.