Lotto, Lottery Software, Excel Spreadsheets: Programming, Strategies
By Ion Saliu, Excel-lent Programmer At-Large

One: The Complexity of Lottery Programming
Two: Original Pick-3 Strategies & Software
Three: More On Gambling Formula & Lottery
Four: Using Excel Spreadsheets to Analyze The Lottery I
Five: Using Excel Spreadsheets to Analyze The Lottery II
Six: Resources in Lotto, Lottery: Theory, Mathematics, Software

Read a genuine analysis of Excel spreadsheets applied to lottery and lotto developing of systems, strategies. Combining Excel analysis with powerful lottery and lotto software programmed by Ion Saliu. It was first posted to rec.gambling.lottery) newsgroup back way when.
I have come up with a large number of patterns or lotto filters, as you can see in my SuperPower lotto software (the WS files). It would be a huge task, unmanageable for a single programmer, to write a program that would check all the parameters, combine them in all possible strategies, and select the most likely to win strategies. When I started, it was the world of 16-bit DOS, with the file size limit of 640 KB. I would have needed many, many megabytes.
Now, it is 32-bit Win95/98 software, but it is very, very slow compared to DOS (in the case of lottery software, which is highly CPU-intensive). I have had no choice (and not much time) but let the computer show me the reports of the parameters (i.e. how the filters fared in the past); based on the past values of the parameters, I would select future values using some statistical methods. One such simple method anyone can notice is that 3 consecutive increases are immediately followed by a decrease most of the time (over 90% of the time) -- and vice-versa. Of course, 90% is not 100%, that's why it is impossible to select winning lotto strategies every time.
I advised in my SuperPower lotto software package a way to play the pick- 3 game. Look at the front/back pairs parameter. It has a median of 33. It also shows values of over 100 -- it means none of the front or the back pairs of a pick-3 drawing is a repeat from the past 100 drawings. Using such a filter, would reduce the number of total possible combinations to 125 (or a probability of 1 in 8). So, one strategy would be based on the "pairs" (Pr) parameter with a value of 100. Other parameters in the same file would have also higher values. At run time, in addition to setting PR to 100) select higher but safer values for other parameters and also use the simple rule of 3 increases/decreases. I have tried to make using my lotto, lottery software as easy as possible. Remember, I am the most frequent user of my lottery software!

+++Move below the table for the continuation+++
* 3-DIGIT Winning Pattern - Layer 1 *
* File: D3; Date: 07-20-1999
--------------------------------------------------------------------------
Line Draw Total Rev All Pot Vr TV Pr Syn Bun Any Val Sum
no. ings 1 1 1 1 1 1 1 1 1 1 1 1
--------------------------------------------------------------------------
Median > 692 692 3 4 2 8 34 115 2 141 9 13
Average > 1068 970 5 3 3 9 45 174 3 209 17 20
StnDev > 931 826 7 4 4 9 41 174 4 260 11 27
--------------------------------------------------------------------------
1 716 1397+ 283- 1- 0- 4+ 6+ 131+ 610+ 2- 137- 40+ 6-
2 189 233- 2741+ 5+ 3 2+ 3- 10- 232+ 3- 191+ 8- 16-
3 252 701+ 89- 0- 3- 1+ 13- 54+ 12- 7+ 27+ 14- 18+
4 467 20- 1203- 5+ 6- 0- 20+ 20- 19- 3+ 20- 21+ 0-
5 287 803+ 2463+ 2- 9+ 1- 6- 55- 55- 2 85+ 7- 4-
6 110 160- 345+ 4- 0- 3- 7- 160+ 159+ 2- 42- 26+ 42+• Let's say the day before the drawing took place, I wanted to see if the moment was right to play a strategy based on the filter Pr1=100. I would run my program that checks any strategy. The number 5000 is a dummy: it represents a maximum value which is never reached. If I don't want to check for maximum values, the lottery software will use that default value of 5000.
* 3-Digit Strategy Checking - Layer 1
File: W3.1; Date: 07-20-1999
*** Frequency of the Strategy in 400 Drawings ***
Tot1: 0 - 5000 Rev1: 0 - 5000
All1: 0 - 5000 Pot1: 0 - 5000
Vr_1: 0 - 5000 TV_1: 0 - 5000
Pr_1: * 100 - 5000 Syn1: 0 - 5000
Bun1: 0 - 5000 Any1: 0 - 5000
Val1: 0 - 5000 Sum1: 0 - 5000
Times: 53
Skips: 4 2 24 6 1 7 1 4 6 31 21 3 1 2 7 9 0 14 9 15 4
Sorted Skips: 0 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 2 2 3 4 4• Our strategy occurred 53 times in the last 400 drawings (let's approximate it to one year). The Skips section shows how many times the lotto software strategy waited between hits. Zero means that the strategy hit in two consecutive drawings.
The worst playing situations occur when the skips reach 10 or more drawings. That would be most costly way to play the strategy. Based on my Gambling Formula, a skip can reach even 55 drawings! That was one of my sins up until not long ago: I believed that it was best to play only strategies with high skips (over 20)...
It is better to play lower skips, around or below the median (a requirement of the Gambling Formula).
• Playing only when "Skips" shows 4 or 5 as the first number:
- playing 21 times @ $150/play = $3150
- number of wins: 14 x $500 = $7000
- net profit: $3850/year (400 drawings).
That profit comes WITHOUT applying any filter to Pr=100!
We want to play with more modest budgets, so we apply some other filters. As I stated before, when a filter such Pr is high, other filters in the same WS file have a tendency to reach higher values. We can set other filters conservatively (i.e. "safe" values). For example:
Tot1=200, Rev1=200, Vr1=1, Syn1=100, Bun1=1, Any1=100.
• Applying other filters in addition to Pr1=100:
- playing 21 times @ $50/play = $1050
- net profit: $5950/year (400 draws)
Actually, just using Pr=100 without other filters generates 130-150 combinations. Using additional filters generates from 10 to 45 combinations.
I think it is a lot more convincing now that even the random events follow rules and formulae; that they can be analyzed scientifically.
•• I received an insightful message from a Brazilian user of my lottery and lotto software. He found my strategy to be FLAWED. After further review, he was right! I rechecked the entire process. I miscalculated. Indeed, I should have counted also the times when the skip went 6 or higher. Actually, I looked at front skips which were already higher than 6. The right strategy is still based on the MEDIAN. Briefly now, if there are more than 5 skips below the median do not play. Also, after 1 or 2 skips above the median, there will follow skips lower than the median -- play the strategy!
Or, play ALL the streaks, but only from 0 to 5. There are 53 streaks.
Playing only from 0 to 5 drawings means 6 runs. Multiplying 53 streaks by 6 runs gives 318 runs. There are 32 winning situations for streaks between 0 and 5. Total winning is $500 x 32 = $16,000. In order to make a profit, we must play no more that 50 lottery combinations per run. In other words, if using additional filters to PR=100 generates 10 combinations to play, the cost will be 10 x 318 = $3,180. If the strategy generates 20 lotto combinations per run, total cost would be 20 x 318 = 6,360. Just 20 combinations per run is pretty common, given the strong co-variance of the filters in the same WS file (the same layer). There is a stronger still co-variance between PR and TV, or between TOT and REV, etc.
Always use other lottery filters in addition to the main filter (PR, in this case). I have received quite a bit of input on the subject of strategies applied to my software. Some users with computer programming skills have written their own utilities to check the values for other filters. Others use the Excel spreadsheet to do comprehensive analyses. Basically, a user opens as a text file the WS reports generated by SuperPower$. If they want to apply the PR the main filter, they will sort the spreadsheet on the PR column. Next, select all the cells where PR is 100 or greater. Paste the block in to a new spreadsheet. Do a data analysis of the new worksheet: get the minimum, maximum, average, median, mode for every column. You'll notice that PR=100+ is accompanied by higher values in other columns as well. Applying other lotto filters in conjunction with PR will substantially reduce the combinations to play (under 10 in quite a few cases).
While developing the lottery software, I was met with astonishing situations. In Pennsylvania lotto 6/48 game some filters were very high from time to time, as it normally happens. In one case, however, they were so high that the software generated only ONE combination to play! In another case, in the old Maryland 6/40 lotto game, the filters were as such that only 8 combinations were generated. Cases like those made me stay in this lottery, lotto software business. It is possible, albeit very rarely, that a huge-odds lotto game can be won with just a handful of combinations!

I presented in this post just one of the lottery strategies that can be used in the Pick-3 game (using PR = 100). Anybody can check it in any pick-3 lottery game. I presented a report for 400 drawings, but I have also checked 1,000 and 2,000 past drawings. (There is now a better HTML report at this address: Pick-3 Lottery Method, Strategy, System, Play, Software). I also presented on one of my main lottery strategies page (Lotto, Lottery Software, Strategy, Systems, Wheels) another strategy. I presented real data for a 6/48 lotto game.
The individual probability is p=1/8. According to the Fundamental Formula of Gambling (FFG), half of the lotto 6/48 numbers (3) in every drawing will be repeats from the most recent 6 drawings. Moreover, there were drawings in which all six winning lotto numbers had been repeats from the past 11-12 drawings, even from the past 6-7 drawings! In the last 500 drawings of the late PA Wild Card lotto game (6 of 48), in 123 cases (25%) all 6 winning numbers were repeats from the last 12 drawings. In 25 cases (5 times a year), all 6 winners were also drawn in the last 7 drawings. More amazingly, in 7 cases, all 6 winning numbers were repeats from the last 4-5 drawings! Again, it can be checked against any lotto database with my lotto free software.
• • There are people who simply do not believe that my previous statement can be true, ever. Gambling is random, and random means a phenomenon that cannot be forecast. Winning chances stay always the same, they can never be improved. Such people stay away from any type of gambling and they are all right with me. But there is something I don't understand. There are players, like in this forum, who fight against any idea that gambling can be analyzed with the purpose to improve player's chances. Why do they participate here? They appear to gamble or, at least, be interested in gambling. They may hope to win without software. They are here because they hope to find winning strategies, or just tips. But their hope seems to take the form of a placebo. They want the lottery strategies to just be very easy. Easy means no mathematics at all, no difficult analyses at all. Thorough analyses just show how difficult gambling can be to grasp; mathematics will just destroy the placebo effect. They only want somebody tell them: "These are cold numbers, these are hot numbers, you should play these 10 lotto combinations!" Nice and easy! But don't you ask them "How much did you spend and how much did you win over the past year, or two years?" The question destroys the placebo effect.

SQL, databases in general, are not suited for the type of statistical lottery analysis. They only have basic statistical functions. You will need to do a lot of coding, writing your own software functions. You would probably need to use a highly sophisticated software programming tool such as Visual Basic, included in a database application such as Access.
The best tool of choice is Excel. The spreadsheet software has a large variety of powerful statistical functions. You need to install the add-in called "Data Analysis". Once installed, it will show up in the Tools menu. Here is what type of analysis I just did for my lotto-5 data file. The lotto game draws 5 numbers from a field of 39. If it is for the first time you've seen my name, I recommend you visit my lottery site first: "Free Winning Lotto and Lottery Software Strategies".
The lotto-5 data file is a simple ASCII (text) file with EXACTLY 5 numbers per line:
1 12 20 28 35
It is also assumed that your drawings are sorted in ascending order. You shouldn't use the drawings as they appeared during the TV drawing show. In Excel, open File menu. Select Open. Choose "Files of type: All (*.*)". Select DATA-5 (or the correct name of your lotto-5 drawings file). Excel is an intelligent application: It will format your Data-5 file in the correct lottery software spreadsheet grid. Your sheet will have 5 columns: A, B, C, D, E (A represents the first number in the drawings, etc.). Let's say your Data-5 file has 500 drawings.
Select column A. Click on Tool, then Data analysis. In the ensuing dialog box select Descriptive statistics and finally Summary statistics. Excel will create a new sheet, named Column1. There are some important numbers in the analysis sheet1, especially "Median" and Mode. The Median divides the column in two halves. The Mode represents the most frequent number in the column. Here is what kind of data I got for my data-5:
The first number (col. A): Median = 5; mode = 1
The 2nd number (col. B): Median = 12; mode = 10
The 3nd number (col. C): Median = 20; mode = 18
The 4th number (col. D): Median = 28; mode = 30
The 5th number (col. E): Median = 35; mode = 39.
If you visit my site, you'll come across what I call the "Gambling Formula". The medians you see above are very close to what the Fundamental Formula of Gambling gives for a game of any probability p.
• The median can also be calculated in advance; i.e. the theoretical value. The only tool you can use is the well-known-by-now Fundamental Formula of Gambling! I call the parameter FFG median.
I give you one more tip now: Use the Median in conjunction with the Mode. How about this kind of number selection? For any position, select numbers between "Median – 4" to "Median + 4". As you can see, the Mode is right within that range. This is not a secret: It is a representation of the so-called "Normal probability rule". The most frequent lotto numbers drawn IN THAT POSITION fall within the range we just set. In the case of my data-5, my best numbers will be within the following ranges:
The first number: 1 to 9
The 2nd number: 8 to 16
The 3rd number: 16 to 24
The 4th number: 24 to 32
The 5th lotto number: 31 to 39.
It is better to analyze larger data files. More than 500 is best, in order to get as close as possible to the gambling formula. In general, in more than 60% of the drawings, the winning numbers will fall in the ranges we set above. While in Excel, you can sort data-5 by each column. You can see how numbers are distributed around the median. Click on the menu item Data, then Sort. Type the range $A$1:$A$500 (in the case of column A from drawing 1 to lotto drawing 500).

Somebody started a thread on using SQL or Access to analyze the lottery. SQL is a database programming language. I pointed out that SQL is not very capable software of analyzing the lottery, since it does not have built-in statistical functions to satisfy such a requirement. I recommended instead the use of Excel, the spreadsheet that is bundled with Access in Microsoft Office Suite.
First of all, I am not a software salesman. I only posted in the thread because I assumed the initial writer already had Excel on his PC. I showed how to use an Excel add-in: "Data Analysis". Its "Summary Statistics" generates very useful reports regarding lottery drawings files. You can read my post again. I need to mention now that my "findings" are, in fact, a consequence of the so-called "normal probability rule". The rule is in turn derived from the "Gaussian Distribution". The normal probability rule establishes the probability for an event in correlation with "the most probable result" in a probability distribution. A file with lottery drawings represents a probability distribution. The "median" is one of the most probable results in drawings series.
Let's take as an example the median of the first numbers in the drawings. In the case of my lotto-5 drawings file, the median of the first number is 5. The standard deviation was 6. The rule of normal probability states that the probability of any first number in the lottery drawings is 95.4% less than 2 standard deviations away from the median, and 99.7% less than 3 standard deviations away. Trying to make it more clearly. My lotto-5 drawings file has over 1000 drawings. Over 97% of the numbers drawn in the first position are between 1 and 18 (which approximates 3 standard deviations from the median).
Over 98% of the lotto numbers drawn in the 5th position are between 21 and 39 (again, approximately within 3 standard deviations). This is valid for one number position at a time. If I want the simultaneous probability of the 1st and 5th numbers, it is .97 x .98 = .95. There is a 95% probability that the 1st AND the 5th numbers will be between 1-18 AND 21-39. The simultaneous probability for ALL five lotto numbers was around 60% for my lotto-5 file. In over 60% of the drawings, the winning numbers were as follows:
1st number: between 1 - 18
2nd number: between 3 - 21
3rd number: between 11 - 29
4th number: between 19 - 37
5th number: between 21- 39
Total combinations of 18 taken 5 at a time is: 8,568.
My lotto-5 game uses 39 balls. Therefore, total combinations of 39 taken 5 at a time is: 575,757. Now, important to note that Excel does not have a function to generate lottery numbers. The user needs to program such functions in Visual Basic for Applications (incorporated in every Office application). Or, do what I do: write specialized lottery software outside Excel or Microsoft Office, using general-purpose programming languages (VisualBasic or PowerBasic). But if you do not program at all, it is obvious that it is far better to select numbers from the ranges determined by the normal probability rule. If you are to choose 5 numbers from the most frequent 5 ranges, the winning probability is 1 in 8,568. Choosing 5 lotto numbers from a field of 39 has a winning probability of 1 in 575,757. In 60% of the cases, you will face odds of only 8,568 to 1 if you choose numbers from the most frequent ranges.
Finally, the facts I have presented here are meaningful only if you already have Excel on your PC. The code I use in my software is entirely my business and I do not make it available. My free lotto and lottery software at software download site does not include the probability feature presented here. I do not accept analyzing your lottery drawings files for any fees.
Verification:
These are the latest results from Pennsylvania lotto-5 game (Cash 5):
1) Saturday 11/20/1999: 8, 11, 14, 35, 39
2) Friday 11/19/1999: 15, 17, 21, 23, 39
3) Thursday 11/18/1999: 1, 6, 11, 14, 35
4) Wednesday 11/17/1999: 4, 5, 9, 19, 29
5) Tuesday 11/16/1999: 1, 10, 22, 31, 39
6) Monday 11/15/1999: 10, 17, 27, 34, 37
7) Sunday 11/14/1999: 10, 13, 19, 27, 34
Drawings #1 and #2 have 5 winning numbers each from the subset generated by the normal probability rule. Drawing #3 has 4 winning numbers; drawing #4 has 4 winners; drawings #5 and #6 have 5 winners each; drawing #7 has 5 winners from the most representative sample.
• I just wrote the program to generate lotto-5 combinations within ranges. The program uses no filtering at all. Indeed, I was wrong regarding the total lotto combinations to play! I mean, wrong, although not quite as wrong as some other calculations indicated.
I used first the following rlotto anges:
1 to 18
3 to 21
11 to 29
19 to 37
21 to 39
The program generated 371,036 combinations. That represents 64.4% of all possible combinations for a lotto-5-39 game. The positive side is that the ranges eliminated 204,721 combinations. That's a very powerful filter, as far as I am concerned.
I used next the following ranges (some love to copy me; they named the ranges 'positional limits'):
1 to 9
8 to 16
16 to 24
24 to 32
31 to 39.
The lotto software generated 53,352 combinations. That represents 9.3% of all possible combinations for a lotto-5-39 game. You should expect to win 1 every 10+ lottery drawings using those ranges. The best situation to play the ranges is after 4 to 8 skips (losses). In other words, if the ranges don't come up after 4 drawings, play them until they skipped 4 more drawings. Evidently, the ranges by themselves are not sufficient. They need to be used in conjunction with other filters. Using other filters, I obtained from 0 (zero) to 8,000 combinations to play. Of course, the winning frequency is lower. In my book, the best way to play the lotto games is to set filters that eliminate the largest possible number of combinations. Of course, you will have the chance to win more rarely, but a jackpot win compensates.
If you are interested in the free lottery software program, I uploaded it to my FTP download site.
The name of the free lotto software program is RANGES5.EXE. You need to download also the file RANGES.5, which consists of the ranges for the 5 numbers. The file is in ASCII format, so you can use any text editor to change it. Right now, the RANGES.5 file looks like this:
To generate ALL possible lotto combinations of N numbers, make the five lines read:
• The 2007 Decision: The software at this web site is NOT free to download. Paid membership is required in order to download Ion Saliu's software. The membership fee is negligible when compared to similar software packages. Without a bit of a doubt, the Ionosphere software you download here is far superior to any software products in similar categories: Lottery, lotto, gambling, Powerball, Mega Millions, Euromillions, Keno, probability, statistics, and combinatorics. Moreover, some of the software titles you find here are absolutely unique. You will not find similar programs regardless of prices. You may download all the software titles during your yearly membership, including all upgrades and updates. It all boils down to about 10 cents per title. You will NOT find a better deal on the planet!
• • The software you download, however, is FREE for you to use during your lifetime. I wish you the longest of quality lifetimes! The Ionic software has no crippled features, and no strings attached. The software is not shareware: It is totally freeware. Read more: Download Great Free Software: Paid Membership Required. You need a PayPal account or a valid credit card to pay via PayPal.
8 16
16 24
24 32
31 39.
1 N (substitute N for particular numbers). For example, to generate all the combinations in a 39-number lotto-5 game, edit RANGES.5 to read:
1 39
1 39
1 39
1 39
1 39.

Six: Resources in Lotto, Lottery: Theory, Mathematics, Software
I have written much more powerful lotto, lottery software ever since. For starters, check out the free utility programs named UTIL and then a specific identifier; e.g Util-6.EXE indicates the utility lotto software for all lotto 6 games. UtilPB works with Powerball, Mega Millions, Thunderball, Euromillions type of lotto games. The statistical function does calculations for the 6 positions of the Powerball (Mega Millions,Thunderball, too). The lottery player can select the most frequent numbers for each position. See the sample file RANGEPB consisting of the most frequent positional numbers in Powerball 5/55/42 for 184 draws. RANGEPB can serve as an input file to the POSITIONAL LIMITS function in UtilPB.EXE. It represents a very powerful way to put together only Powerball numbers of high frequency. If the lotto numbers in each position represent 50% of total frequency, the final jackpot probability is 0.56 = 1 in 64. If the numbers in each position represent 60% of total frequency, the final lotto jackpot probability improves to 0.66 = 1 in 22. The result file can be diminished further by using the PURGE lottery software routines in MDIEditor and Lotto WE or LotWon lotto software.
For more, read: • Software: Utilities for Lottery, Gambling, Lotto, Powerball, Mega Millions, Thunderball, Pick 3, Pick 4.



~ Also applicable to DOS LotWon lottery, lotto software; plus Powerball/Mega Millions.
A take on Gail Howard's lotto system.



Socrates Home
Search
Ion, Help!
Contact Ion
What's New
Fundamental Formula of Gambling
Probability Theory
Combinatorics, Permutations
Statistics Software
Standard Deviation
Lottery, Lotto, Software, Systems
Blackjack Strategy
Roulette Systems
Horse Racing Software
Sports Betting, Football, Software
Baccarat Theory, Software
Ion Saliu's Book of Records
Random Generator, Odds Calculator
Newest Writings
Download Free Software
Content Categories
All Pages, Sitemap
Message Board

Copyright ©1997-2008, Ion Saliu. All rights reserved worldwide. Reproduction, in any form, of the contents of this site is strictly prohibited. Read important copyright information regarding web site www.saliu.com •