The Best Software to Generate Numbers, Words, both Random and Lexicographical:Exponents, Permutations, Arrangements, Combinations, Powerball, Mega Millions, Euromillions, Horse Racing

By Ion Saliu, Programmer of Lexicographic and Randomness Software

PermuteCombine ~ fundamental combinatorics software
Combinations ~ lottery combinatorial software
LexicoWheels ~ lotto wheeling software for lexicographic lotto wheels.

I wrote previously about generating a wide variety of numeric and alphanumerical sets. I wrote also software to generate random and lexicographical sets, both for numbers and words. This page shows at the end related articles at this Web site and previous software I wrote.

One fact for sure: I always make matters I master intuitive to others. I link number generation, combinatorics in general, to real life. Then, I throw in the mix a most useful utensil: Software. Jargon might be unavoidable at times, but I always try to keep it clear.

Any finite number of elements can be put together in groups based on certain rules. Such groups are known as sets. There are four types of sets, from the most inclusive to the least: exponents, permutations, arrangements, and combinations. The number sets are the most important mathematically. We can substitute the numbers by alphanumerical elements, such as words, names, any strings of characters. In the case of the alphanumerical sets, mathematics works with the indices, indexes of the respective elements.

Here is how that grandiose software of mine, Permute Combine treats the generating of various types of sets.

Exponents ~ 4 elements, with values from 0 to 2; e.g. 4 triples in European soccer pools (0 represents a tie or draw; 1 is for home team win, 2 for visitor win); total sets: 4 ^ 3 = 64 -
0 0 0
0 0 1
0 0 2
....
2 1 2
2 2 1
2 2 2

Permutations ~ 4 elements; total sets: 4! = 1*2*3*4 = 24 -
1 2 3 4
1 2 4 3
1 4 2 3
....
4 3 1 2
4 3 2 1

Arrangements ~ 8 elements taken 3 at a time; e.g. horse racing trifectas in races with 8 horses; total sets: 8*7*6 = 336 -
1 2 3
1 3 2
2 1 3
....
7 8 6
8 6 7
8 7 6

Combinations ~ 49 elements taken 6 at a time; e.g. a lotto game drawing 6 numbers from a field of 49; total sets: Arrangements(49 - 6) / Permutations(6) = Combinations(49, 6) = 13983816 -
1 2 3 4 5 6
1 2 3 4 5 7
1 2 3 4 5 8
....
43 45 46 47 48 49
44 45 46 47 48 49

Permute Combine generates all of the above, plus special-purpose or derived sets, such as Powerball, Mega Millions combinations, Euromillions combinations and two-in-one generalized lotto games.

The main menu of this much sought-after mathematical application:

Each module consists of at least two functions:
~ 1: Numbers – in lexicographical order;
~ 2: Random numbers.

The following types of sets have two more functions Exponents, permutations, arrangements, combinations:
~ 3: Words – in lexicographic order (sequentially);
~ 4: Random words.

The 'words' feature is not available for Powerball/Mega Millions, Euromillions and generalized Two-In-One lotto games.

Generating words, or text in general, is useful in pairing or teaming situations. I received requests for generating player pairings in golf clubs. Or generating student teams for various projects in educational institutions. One educator presented me with a situation of some 20 students who were assigned in teams of 5 students or so. The teacher wanted to make sure that a team would not have the same composition more than once. Well, she could choose from Combinations (20, 5) = 15504 possible teams!

The 'text' generating functions require that the words (names, etc.) are first written to a simple text file, with one entry per line. One entry per line assures that multiple words can be used. For example, First_Name, Last_Name of the same person can be written in one line.

Permute Combine is still a totally unique piece of software, although I published it in 2003. The new version flies even higher in that rarefied ionosphere of valuable originality!

Combinations brings much more to the table. It generates lotto combinations in steps at a user's choice.

Permute Combine generates all the combinations in the lotto game step by step. That is, the step is always 1. In other words, every combination is generated; no lotto combination is skipped.

On the other hand, Combinations skips a constant number of combinations before generating the next combination. That skip is actually what I call the step. STEP is a keyword in the computer language I program in — PowerBasic.

Let's take as an example a simple “lotto” game: Drawing 6 numbers from a field of 10. Total combinations (10, 6) = 210. Let's think of generating sui generis lotto wheels aiming at the '4 out 6' prize. We use here the hypergeometric distribution probability to calculate the “odds” for the ' 4 out of 6' situation. First, total combinations (n, k):

n!
C(n, k) = --------------
k! (n – k)!

or
n*(n-1)*(n-2)*(n-3)*...(n-k+1)
C(n, k) = -------------------------------------
1*2*3*...k

n! represents the factorial and is calculated as 1*2*3*4*...*n. For example, the lotto 6/49 game has a total of [49 * 48 * 47 * 46 * 45 * 44] / [1 * 2 * 3 * 4 * 5 * 6] = 13,983,816 combinations.

In our example, n = 10 and k = 6.

For the '4 of 6' guarantee, we figure out that the 6 winning lotto numbers break down into Combinations (6, 4) = 15 groups of 4. A total n - 6 numbers were not winners. In the lotto 6/49 game, n – 6 = 43; in the 10/6 case, n – 6 = 4. We combine the (6, 4) groups with every combination of 2 from the (n – 6) group of non-winning lotto numbers. This formula can be expressed as:

C(n, k)
P(m of k from n) = ----------------------------
C(k, m) * C(n-k, k-m)

We simplify in order to use the “odds” in conjunction with Combinations. In the case of (10, 6) and the '4 of 6' prize: n = 10, k = 6, m = 4.
C(k, m) * C(n-k, k-m) = C(6, 4) * C(10-6, 6-4) = C(6, 4) * C(4, 2) = 15 * 6 = 90.
For lotto 6/49:
C(k, m) * C(n-k, k-m) = C(6, 4) * C(49-6, 6-4) = C(6, 4) * C(43, 2) = 15 * 903 = 13345.

We can use those values as step. We attempt to generate special lotto wheels based on the lexicographical index. In the 10/6 or (6/10) lotto case, there is a total of 210 combinations. The step is 90, for a '4 out of 6' prize. The odds of getting '4 out of 6' can be expressed as '1 in 210 / 90', which is approximately '1 in 3'. We run Combinations, function 'L - Standard Lotto & Keno', with the parameters 10, then 6, then step = 90.

1 - 1 2 3 4 5 6
91 - 1 3 5 6 7 8
181 - 2 5 7 8 9 10

In this case, the combinations generated total exactly 3, matching the mathematical probability. But this situation is very rare in order to guarantee 100% the '4 of 6' prize. As a rule, the “wheels” generated by Combinations do NOT assure a 100% guarantee for the respective prize. But, on the average, such wheels assure 2 prizes in 2 tries. Thus, these “lotto wheels” come up with the '1 in odds' guarantee over the long run!

The wheel above started at position 1 (the very first lotto combination in the field). We can start at any position, between 1 and 90 (for this lotto 6/10 case and '4 of 6' guarantee). For example, position 2:

2 1 2 3 4 5 7
92 1 3 5 6 7 9
182 2 6 7 8 9 10

How low can we go and still get '1 in odds' lotto wheels? As you can notice, these lotto wheels are totally unique: They don't have a single combination in common. Here is the formula for the last 'start' position:

Start = (C(n, k) MODULO Step)

In this 10/6 example, the last starting position available is (210 modulo 90) = 30. By the way, modulo gives the remainder of a division. In this case, the remainder of 210 / 90 is 30. Thus, the last available '4 of 6' lotto wheel for (10, 6) is:

30 1 2 3 6 8 10
120 1 4 7 8 9 10
210 5 6 7 8 9 10

We can't go any further. We reached the end, indicated by the last index in the field: Combination # 210. The maximum amount of totally unique lotto wheels is 30 for these parameters. If we try the next starting position (31), we only get 2 combinations in the (invalid) lotto wheel:

31 1 2 3 6 9 10
121 1 5 6 7 8 9

I suggest as starting positions indexes from the median zone, such as 14, 15, 16.

And, still, LexicoWheels brings much more to the table. It generates lotto wheels based on lexicographical indexes. The program does all the calculations automatically. Each lotto wheel guarantee (e.g. '4 of 6') has a specific step and a specific start index.

The user has the option to override the defaults, selecting manually the step and the start. That way, you can generate a multitude of lotto wheels for close parameters. The main idea is to check the entire collection of wheels against a file of lottery results (drawings). Every lotto wheel with combinations from the optimal zone will hit higher prizes (than its guarantee) sooner or later. The user will definitely select lottery wheels that show a delay in hitting higher prizes.

One good strategy is to decrease the start value. A shorter step will generate more combinations, but the resulting lotto wheel will lead to a higher winning probability.

The lexicographical lotto wheels produced by Lexico Wheels do not assure a guarantee drawing by drawing. That is, the will might not hit in every lottery draw. Rather, it will assure the guarantee based on odds in a number of drawings. For example, a lotto-6 wheel with the guarantee '3 of 6' has 57 combinations (lines). Chances are, it will hit two times in 2 drawings. Chances are much better that the wheel will generate 10 hits in 10 drawings. On the average, will offer one hit per draw. You can figure out it goes like this: One draw with two hits, another draw with zero hits...average is one win per lottery drawing.

One advantage of the wheels created by Lexico Wheels: They do NOT need to be randomized. Actually, they should never be randomized! The randomization performed on regular lotto wheels aims at creating combinations from the inside of a lotto field. As you've seen, a lexico lotto wheel for 10 numbers with the '4 of 6' guarantee is equidistant from the start (index #1) and the end (index #210): combinations #15, 105, 195. Before you convert the wheel to your picks, you make sure your lotto picks are sorted in ascending order; e.g. 3, 7, 12, 19, 22, 23, 35, 38, 42, 49.

LexicoWheels generates lotto wheels for many games: Lotto 5, 6, 7, Powerball, Mega Millions, Euromillions, and generalized Two-In-One lottos.

Essential Resources In Comprehensive Generating: Exponents, Permutations, Arrangements, Combinations, Powerball, Mega Millions, Euromillions

Here is a list of my writings on the topic of comprehensive set generating and combinatorics in general.

Of course, everybody loves to feast on great software, especially when it is free! My combinatorics software (and other categories) is absolutely free to run, for an unlimited period of time. However, only the registered members have a right to download the software. Membership requires a nominal fee — the most reasonable there is to connect to the greatest and most useful software ever created. No kidding! Read the conditions to becoming a registered member: Download Great Free Software: Paid Membership Required.