Your Atari Picks The Numbers For Any Lottery Game
BY MATTHEW J. W. RATCLIFF
Now you can play any lottery with numbers generated by your Atari -and see your odds of winning with any number of bets. This versatile BASIC program works on any 8-bit Atari computer with a minimum 48K.
Whenever the Missouri Lotto jackpot approaches 10 million dollars, I get the "lottery fever" and buy a few tickets. Knowing the odds (several million to one), I seldom play. Still, the vision of becoming a multi-millionaire is enough to send me to the grocery store to play every now and then.
Selecting lottery numbers can be a difficult task. Even though no group of numbers is any more likely to win than another, some people have systems, based on family members' birth dates, aniversaries, and the like. Others like to pick random numbers in hopes of being more likely to match up with the "randomness" of the lottery machine.
One week I let the lottery computer make random picks for me on 10 plays. It turned out that I didn't match a single number for that week's drawing in any of the 10 plays. The next time I played, just for fun, I used my Atari computer to generate 10 random numbers and played those. One game matched three of six. There wasn't any money in it, but it made me feel my Atari was a bit more lucky (or maybe just more genuinely "random") than the lottery machine's picks.
Most computers generate random numbers with a mathematical algorithm that takes a very large prime number and starts dividing it, giving the remainder as your random number. The sequence varies based on a "seed," usually provided by the computer's system clock. The numbers aren't really random at all, but actually part of a very long, repeatable series of numbers. In contrast, the Atari home computer uses an electronic "white noise" generator to create random numbers. This device is the sum of many different signals, and at any point in time sampling it will create a very "random-looking" number.
Thanks to this feature of your Atari, this Lotto Picks program will give you just about the most random numbers you can get from a computer. It's the way I like to play the lottery, and I hope it works for you too. If you're not interested in gambling, you might find it interesting simply to pick numbers and then watch the drawings, without actually playing, to see how often your Atari hits the mark. Studying the odds calculated by Lotto Picks might prove educational to those of you studying probability and statistics in school - and maybe convince you to keep your money in your pocket instead of lining the state's coffers.
Getting Started
Type in Listing 1, LOTTO.BAS, check it with TYPO II, and be sure to
SAVE a copy to disk.
When RUN, Lotto Picks presents the main menu, where you can set the minimum, maximum, and total lottery numbers to choose. You can easily adjust the many options and settings to play any lottery numbers game. To change any of the settings shown, simply press the letter shown beside that setting, then type in a new number or value, and press [RETURN].
When you have the settings you want, press [A] to pick your lottery numbers. The program will immediately generate the required number of random numbers and display them. Once you have numbers displayed, a small menu allows you to enter [P] to print the picks, [A] to select again, or [M] to return to the main menu. If you want to print all your picks you must press [P] after each one.
The current minimum number is 1, as shown next to menu option B. If your lottery starts with a different number (some start with zero), press [B] and type a new value. To save yourself of changing the value every time you run the program, you can change the value of PMIN in line 70 of the program, and SAVE it to disk. Similarly, to change the maximum possible number, use option C, or change the value of the variable PMAX in line 70 of the program, and SAVE the changed program to disk. (The current maximum lottery number is 48, the value for the Missouri State Lottery.)
Option D lets you set the total of numbers to be picked at a time. For most lotteries, six numbers are selected for a game. Some states, however, have different games with variations on the total to select. Here in Missouri we have Lotto, which lets you pick 6 numbers out of 48; PICK3 (3 of 30, 0 to 9 for each digit); and Lotto America (6 of 54). Adjust the PCNT variable in line 70 to make a permanent change.
Select option E to allow or disallow duplicate numbers. In most lottery games you pick a group of 6 different numbers from a pool of 48 or more. Other smaller games (which are easier to win) allow you to pick a group of 3 or more numbers, each from digits zero through 9, for example. In this case, you may pick duplicate numbers.
Playing the Odds
A counter at the top of the main menu helps you keep track of your
picks. Press [G] to reset this counter. This number appears on your printouts,
next to your picks. It is also used to determine your odds of winning when
you use option H, Calculate Odds. The more times you play in a single drawing,
the greater your chances of winning.
Based on the various options for a game, including whether or not duplicates are allowed, your odds of winning are calculated and displayed. Selecting 6 numbers from a 69 possible different numbers results in odds of nearly 110 million to one. In the unlikely case there are 70 or more possible numbers the calculations will result in a floating point overflow - in other words, the Atari computer simply cannot calculate your odds with that many numbers.
Odds for single plays are shown on the back of virtually all lottery tickets. Lotto Picks keeps track of the total number of picks you have made since starting the program. When odds are calculated, they are displayed for one play and for the total number of plays for which you have selected numbers (assuming none of the plays are identical). Due to the Atari's low precision floating point math (only 6-byte single precision, as compared with 12-byte double precision of most other computers), your odds may not exactly match those printed on your lottery tickets, but there should he only a small error.
If you are picking a number from 0 to 9, duplicates allowed, and you choose 3 numbers, then your odds of winning arc I in 1000. Why? Because duplicates arc allowed, there are 10 ways to pick the first number (0 through 9), 10 ways to pick the second, and 10 ways to pick the third, or: 10 * 10 * 10 = 1000.
When selecting a small set of unique numbers (no duplicates) from a larger pool, your odds are calculated differently. If you are picking 6 numbers from 40, your odds are not 1 in 40 to the 6th power (something like one in 4 billion which would he your odds if duplicates were allowed!). When you pick your first number, then you have one of 6 chosen. There are 5 left to choose, and there are 39 numbers from which to select your next number. There arc 38 ways to pick the third, 37 to pick the fourth and so on. The calculations work out to the following equation:
One chance in 40!/6!*(40-6)! = 3,262,622
The exclamation point (!) means factorial. Six factorial, for example, works out as follows:
6!=6*5*4*3*2*1 =720
The factorial for 40 is a much larger number, something like 8 times 10 to the 47th power.
From this example we can see that there are over three million different ways we could pick six unique numbers from a group of 40. To compute your odds, you take the factorial of the total of numbers to choose from (N) and divide that by the factorial of the total numbers you choose (R) and the factorial of the difference:
Odds are 1 in N!(R!*(N-R)!)
The number you choose from will always be greater than the numbers chosen. If they were equal, your odds of winning would be one in one (zero factorial is equal to one) and the lottery would very quickly go broke.
If all the math confuses you, don't worry. Simply let Lotto Picks do all the work for you. When you are done printing your selections, you can use option F to send a form feed instruction to the printer, to move the paper up to a new sheet. Press [Q] to quit, then head to your local lottery outlet and place your bets.
Remember, you aren't any more likely to win using Lotto Picks than with any other method. However, try Lotto Picks and you might find that it does a better job of "random picks" than the lottery computer down at your local grocery store. Who knows, you might even win a few dollars.
Long-time ANTIC contributor Matthew J. W. Ratcliff lives in St. Louis, MO.