Lotto

Copying lotto

Lotto contains the following programs:

Lottery Program Description
Lotto combo.c Subroutine to Calculate Combinations
getlot.c Subroutine to Calculate Probability
lotprob.c Prints Probability
lotto.c Lotto (your ticket)
qpick.c Lotto (quick picks)

By reading the source code in getlot.c you can learn how to calculate the probability for winning each of the 4 prizes.

There are no parameters for the print program. Just run it directly from the console.

The lotto program allows you to play Lotto for 100 years to see how often you win each prize. This program has 6 parameters, the six numbers on your ticket. For example,

      lotto 01 03 05 07 09 11

The qpick program allows you to play Lotto over and over to see how often you win each prize. This program has 1 parameter, the number of times you want the program to play lotto. For example,

      qpick 100000

In this example, the program plays lotto 100 thousand times and then prints the totals and the chi square test for the run.

By playing lotto or qpick, you can see how many times you have to play just to break even.

Notice the last line 0 before the total line. This line shows you how often you do not win a prize.

Earnings are based on a cost of $0.50 per game. You usually purchase two games for $1.00. The winning pool is one half the sales revenue from the lottery. The all the prizes are a different percentage of the winning pool, divided among the winners. In this program, the sales revenue is assumed to be derived only from your participation.

You can see from running the program that if you buy 100 thousand tickets, you usually lose more then 75 thousand dollars. The qpick program allows you to play as often as you wish. The lotto program runs twice a week for 100 years. That gives you 20872 chances to win with your favorite numbers at a cost of fifty cents per chance.