Lottery Probability

Copying lottery

Scope

The programs in this package are aimed at the largest possible audience within the United States. Each state and country has its own set of lotteries. It is not feasible in a package of this size to include all lotteries for every country, or for every state in the United States.

Therefore this package includes:

Lottery Location
Powerball Multi-state
Mega Millions Multi-state
Lotto Illinois
Little Lotto Illinois
Pick 3 Illinois
Pick 4 Illinois

Lotteries everywhere change according to market demands. If the programs in this package become obsolete because of a change in the lottery, the message in each program is still the same:

No matter how many times you play the lottery, the more you play, the more money you lose.

The lotteries in this package represent two multi-state lotteries, and four state lotteries. It is easy to create other lottery programs from the programs in this package.


Programs

Lottery contains the following programs:

Lottery Program Description
Every Lottery combo.c Subroutine to Calculate Combinations
Mega Millions getmm.c Subroutine to Calculate Probability
mmprob.c Prints Probability
megamil.c Play with your ticket
qpick.c Play with quick picks
Powerball getpb.c Subroutine to Calculate Probability
pbprob.c Prints Probability
pbgm.c Play with your ticket
qpick.c Play with quick picks
Illinois Lotto getlot.c Subroutine to Calculate Probability
lotprob.c Prints Probability
lotto.c Play with your ticket
qpick.c Play with quick picks
Illinois Little Lotto getlot.c Subroutine to Calculate Probability
lotprob.c Prints Probability
lotto.c Play with your ticket
qpick.c Play with quick picks
Illinois Pick 3 getp3.c Subroutine to Calculate Probability
p3prob.c Prints Probability
pick3.c Play with your ticket
Illinois Pick 4 getp4.c Subroutine to Calculate Probability
p4prob.c Prints Probability
pick4.c Play with your ticket

The getmm program is based on the change to the lottery on May, 2004.

By reading the source code in getmm.c, getpb.c, getlot.c, etc., you can learn how to calculate the probability of each prize in the lottery. combo.c contains the textbook definition of the combination function C(n,r). The logic in getmm.c, getpb.c, getlot.c, etc., is based on the Chao reference, below.

There are no parameters for the probability print programs, mmprob, pbprob, lotprob, etc. Just run them directly from the console.


Your Favorite Tickets

megamil, pbgm, lotto, etc., allow you to play the lottery to see how often you win each prize with your favorite numbers. These programs have one parameter for each number on a ticket. For example,

      megamil 01 03 05 07 09 11
      pbgm 01 03 05 07 09 11
      lotto 01 03 05 07 09 11

These programs play your ticket twice a week for 100 years to see how many times you win over that time span.


Quick Picks

In each directory, qpick allows you to play the lottery to see how often you win each prize with quick picks. This program has one parameter, the number of quick picks you want the program to play. For example,

      qpick 100000

In qpick, the program plays the lottery with 100 thousand quick picks and then prints the totals and the chi-square test for the run.

Normally, you buy a lottery ticket, and then wait for the drawing to see if you win. In the quick pick program, you first create the drawing, and then buy 100 thousand tickets to see if you "would have" won the lottery, had you chosen the right numbers. In a program, you can do this and still maintain your integrity, because the program is not conscious of the winning numbers when it computes the 100 thousand trials.


Net Earnings

By playing the lotteries with megamil, pbgm, lotto, and qpick, you can see how many times you have to play just to break even. Even if you win 10 thousand dollars in one test, you may lose 20 thousand dollars in the next test. By purchasing 100 thousand quick picks, over and over again, you lose 75 to 90 thousand dollars each time you play, most of the time.

In a real lottery, the Grand Prize is Parimutuel. In megamil, pbgm, and lotto, the Grand Prize is the same as the normal prize for the first drawing of the lottery.

Notice the last line 0 0 before the total line. This line shows you how often you do not win any prize. It is roughly 97 to 98 percent of the time.


Sample Quick Pick Lotteries

Mega Millions
Powerball
Lotto

Notice that you lost roughly 90 thousand dollars in each of these tests.

The first line of the test is the drawing. The mega ball or powerball is the last number on the right, after the dash. The Lotto drawing just has 6 numbers.

The first column is Matches. This tells you which prize you won. The number on the left is the number of balls that you matched, but not the mega ball or the powerball. The number on the right tells you whether you matched the mega ball or powerball. For Lotto, the Matches column just has one number.

The Wins column tells you how many times you won each prize.

The Prize column tells you how much money you won for each prize.

The Expected column tells you how many times you are expected to win each prize, considering the number of tickets that you "bought".

The Odds column tells you the probability for winning each prize.

The Total Wins tells you how many tickets you purchased.

The Total Prize tells you how much money you won, overall.

The Total Cost is simply one dollar times the number of tickets. If the ticket price changes, this calculation will change in a new version of the program.

The Net Income is usually negative. It tells you how many dollars you won, minus the number of dollars that you spent.

The Chi-square number should fit within the Range 95 percent of the time.


References

The calculation of probabilities for each lottery prize is based on an example in the following book:

Lincoln L. Chao
Statistics for Management
2nd Edition
Palo Alto: The Scientific Press, 1984
Chapter 4, Events and Probabilities
Section 3, Computing Probability
Example 4-13, Part 2

Lincoln L. Chao published his book while at California State University, Long Beach.

The chi-square test is similar to:

Chapter 12, Chi-square Tests
Section 3, Testing for Goodness of Fit
Formula 12-3
Example 12-4

In Table 12-3, each category in the chi-square test has a different expected frequency. This corresponds to the different expected frequencies for each prize in the lottery.

In the Mega Millions and Powerball lotteries, there are 10 categories for the chi-square test. The 95 percent range for the chi-square test is based on 9 degrees of freedom.

In Lotto, there are 4 categories for the chi-square test. The 95 percent range for the chi-square test is based on 3 degrees of freedom.