Tag Archives: ticket

Pattern Analysis of MegaMillions Lottery Numbers

Everyone wants to get rich, especially if it only costs them $1. Fortunately, many local state governments host lotteries, allowing their constituents to donate cash into the budget in hopes of winning a multi-million dollar prize. In practice, most lottery drawings consist of a series of balls drawn randomly from a chamber which should guarantee a fair opportunity for everyone to win. Theories of rigged lotteries and fraud, however, run rampant across the Internet.1 The system is accused of not holding live drawings, publishing winning numbers prior to drawing them, permitting the tweaking of data archives to avoid payouts, intentionally modifying balls, or using balls with painted numbers whose natural weight affects their likelihood of appearance.

Rather than debunk any of these theories of lottery fraud or rigging, this article reveals the trends and patterns of winning lottery numbers for public scrutiny using basic data analysis. It uses the results of the MegaMillions lottery and consists of the following analyses:

distribution of winning numbers over time
behavioral stratification of numbers based on numerical position
relationship between mutually winning numbers
common differences between winning numbers
winning number frequency
While such scrutiny has the potential to yield useful results, such as identifying the existence or lack of “better numbers” to play, it is presented so as to appeal to those interested in number patterns.

MegaMillions History
Recently, MegaMillions drew the largest jackpot ever recorded at $370 million, exceeding the previous record held by PowerBall.2 The prizes were not always so large, nor did the participants span the United States. Beginning life in 1996, MegaMillions originally existed under a different nomer: “The Big Game.” For two years this lottery was drawn weekly on Fridays until 1998, when a Tuesday drawing was added. Over the past eleven years, the number of participating states has doubled from only six to twelve. Although there are minor interstate variations regarding how jackpots are paid to winners, the basic game play remains the same.3

A single dollar in MegaMillions purchases a 1 in 175,711,536 chance of landing the jackpot. A player may opt for a “QuickPick” set of numbers generated automatically by a computer or they may choose to select their own numbers. Since 2005, MegaMillions allows players to choose five numbers between 1 and 56 plus a sixth number, the MegaBall, between 1 and 46. This, however, was not always the selection pool. When the “Big Game” was conceived, players were given a pool of numbers 1 through 50 to choose for their first five balls and numbers 1 through 25 for their sixth. Beginning in 1999, players were offered the numbers 1 through 50 for the five regular balls and 1 through 36 for the sixth. When the game became MegaMillions in 2002, players selected numbers between 1 and 52 for both the five regular balls and the MegaBall
Gathering Data

As a first step, it was necessary to obtain a collection of MegaMillions’ lottery numbers. Fortunately, the New Jersey Lottery website has an archive of all winning numbers since September 6, 1996.5 As an added bonus, the archive of numbers exists in both HTML format for a pretty web presentation and as a delimited file which is conducive for importing into a database. For the purposes of this analysis, the winning lottery numbers were imported into Microsoft SQL Server Express for processing queries. Subsequent graphs were then created with Microsoft Excel to visualize the trends and behavior.6

The delimited file of winning lottery numbers contained the results for 1078 drawings and provides the following fields:

Year – formatted as YYYY
Month – formatted as MM
Day – formatted as DD
Day of Week – formatted as Tuesday and Friday
Ball 1, 2, 3, 4, 5 – as an integer
MegaBall – as an integer
Prize Payout – when present, formatted as a decimal value
Date – formatted as YYYYMMDD

Distribution of Winning Numbers Over Time
The first trend analyzed was whether or not the numbers occur with an even distribution. Balls 1, 2, 3, 4 and 5 were consolidated into a single list to analyze their overall frequency of occurrence. Each separate version of the lottery – two editions of BigGame and two editions of MegaMillions – were analyzed independently to identify any outlying activity. Subsequently, a similar grouping was performed to determine the distribution of the MegaBall number. The following charts detail the number of times each number was selected over the course of the the entire span of MegaMillion’s drawings.

When the BigGame debuted, players were allowed to choose numbers between 1 and 50 with a MegaBall ranging from 1 to 25. Each number has been drawn at least eight times as compared with the most frequent winners that occurred twenty-seven times. Overall, the numbers have been drawn approximately seventeen times each. The most frequent number, 35, exceeds the mean by 2.76 deviations as compared with the least occurring number, 49, which lagged the mean by -2.46 deviations. The first version of the BigGame is the only drawing with a descending trend line that when combined with the deviations identify the distribution as slightly abnormal. The MegaBall number 17 appeared fifteen times while 23 occurred only once. The average MegaBall was drawn seven times.


The BigGame was changed on January 13, 1999 to increase the number of available MegaBalls from pool of 25 to 36. The primary drawing pool remained the same, ranging between 1 and 50. Each number has been drawn at least twenty-one times while the most frequently drawn number has appeared forty-six times. Overall, all numbers have been drawn roughly thirty-four times. Only one number, 4, exceeds two deviations from the mean at 2.11 deviations. 19 was -2.29 deviations from the mean, the only number to appear less than two deviations from average. The second version of the BigGame has the flattest trend line that when combined with the deviations identify the distribution as normal. The numbers 2 and 3 were drawn the most as MegaBalls at fifteen times apiece while 11 was drawn the fewest at four times. On average, each MegaBall appeared ten times.


On May 15, 2002 the MegaMillions drawing expanded the pool of numbers available to players to range from 1 through 52. Each number has been drawn at least twenty times while the most frequently drawn number has appeared forty-five times. Overall, all numbers have been drawn roughly thirty-one times. The two most drawn numbers, 32 and 10, are the only two numbers to deviate from the mean by a factor larger than two; 2.59 and 2.41 respectively. The least drawn number, 33, is only -2.04 deviations from the mean. Although the linear trend line rises modestly, the primary numbers have a relatively even distribution over time. The MegaBall ranges from 1 through 52. The number 34 was drawn the most on 14 occasions while 51 appeared only once. Overall, each MegaBall has appeared an average of six times.


Players have had the option of drawing numbers between 1 and 56 since June 22, 2005. Every number has been drawn at least ten times while the most frequently drawn number has appeared thirty times. Overall, each number has appeared an average of twenty times. Despite being drawn the most, both 7 and 53 are only 2.17 deviations from the mean. Even the least drawn number, 47, is -2.17 deviations from the mean. Overall, the primary numbers have a relatively even distribution over time. The MegaBall ranges from 1 through 46. 4 and 42 share the most drawn position with nine wins while many numbers round up the low end with only two wins. Overall, each MegaBall has appeared an average of five times.

Behavioral Stratification of Numbers Based on Numerical Position

After looking at the behavior of the numbers in aggregate, the occurrence of numbers respective to their position was analyzed. Unfortunately, the lottery does not store the numbers in the order they were drawn. Rather, the data file saves the winning lottery numbers in ascending order.7 As such, positional analysis focused on how the numbers are stratified within their given position.

It is important to recognize the four variations of the lottery’s number pool has an impact on the ratio of occurrence for each number. As such, the data was broken into four sets titled (uncreatively) version 1, version 2, version 3 and version 4. Winning numbers per position were counted to determine the numbers that win most frequently within each set. Then, an aggregate winning percentage was assigned by combining the win ratio of each set multiplied by a time factor to obtain the overall likelihood of a number to win. The time factor represents the percentage share of drawings per version, which equates to 15.95%, 32.37%, 30.05% and 21.61%, respective to MegaMillions versions one (original) through four (current).

Each of the six graphs represent the top fifteen numbers per position:

Green bars represent the current version of MegaMillions where players choose from numbers 1 through 56 and a MegaBall number of 1 through 46.
Blue bars represent the weighted aggregation of a number’s winning percentage from all MegaMillions drawing variations since 1996.
The red line represents a five variable polynomial trend line to the winning percentage of the current MegaMillions drawing pool.


Ignoring the version differences in number pooling across the lottery’s lifetime, the first ball has ranged between 1 and 37 with an average winning number of 8. Looking at the current version of MegaMillions, the first ball shows a steeper trend curve with nearly twice the drawings on winning numbers as any other ball. MegaMillions winning numbers ranged from 1 through 37 with an average winning ball of 17 since 2002. The numbers 7, 5, 1, 2 and 3 represent 39.91% of the winning numbers on the first ball.


Ignoring the version differences in number pooling across the lottery’s lifetime, the second ball has ranged between 2 and 46 with an average winning number of 17. Looking at the current version of MegaMillions, the second ball shows a shallower trend curve. MegaMillions winning numbers ranged from 2 through 43 with an average winning ball of 22 since 2002. The numbers 13, 12, 17, 25, 10, 18, 20, 14 and 21 represent 40.77% of the winning numbers on the second ball.


Ignoring the version differences in number pooling across the lottery’s lifetime, the third ball has ranged between 5 and 54 with an average winning number of 29. Looking at the current version of MegaMillions, the third ball shows the shallowest trend curve. MegaMillions winning numbers ranged from 3 through 54 with an average winning ball of 26 since 2002. The numbers 20, 35, 31, 25, 37, 26, 32, 24, 23 and 38 represent 39.06% of the winning numbers on the third ball.


Ignoring the version differences in number pooling across the lottery’s lifetime, the fourth ball has ranged between 5 and 55 with an average winning number of 35. Looking at the current version of MegaMillions, the fourth ball’s trend curve begins to steepen. MegaMillions winning numbers ranged from 7 through 55 with an average winning ball of 35 since 2002. The numbers 51, 42, 46, 36, 48, 40, 38, 39 and 49 represent 40.77% of the winning numbers on the fourth ball.


Ignoring the version differences in number pooling across the lottery’s lifetime, the fifth ball has ranged between 13 and 56 with an average winning number of 44. Looking at the current version of MegaMillions, the fifth ball’s trend curve steepens sharply. MegaMillions winning numbers ranged from 26 through 56 with an average winning ball of 41 since 2002. The numbers 53, 54, 56, 52 and 55 represent 42.92% of the winning numbers on the fifth ball.


Ignoring the version differences in number pooling across the lottery’s lifetime, the MegaBall has ranged between 1 and 52 with an average winning number of 20. Looking at the current version of MegaMillions, the MegaBall’s trend curve is relatively flat. MegaBall winning numbers ranged from 1 through 46 with an average winning ball of 23 since 2002. The numbers on the graph represent 44.64% of the winning numbers on the MegaBall.

Relationship Between Mutually Winning Numbers

Additionally, an analysis was performed to determine which numbers “win together.” After all, a player does not need to pick all six numbers in order to win money from MegaMillions. Therefore, all possible combinations of balls 1, 2, 3, 4 and 5 were formed to analyze the occurrence of ball relationships.


In the current version of MegaMillions, pairs of numbers win repeatedly quite often. In the lottery’s lifetime, particular pairs have won regularly.


There are ten combinations of ball pairs: [1 2], [1 3], [1 4], [1 5], [2 3], [2 4], [2 5], [3 4], [3 5], & [4 5]. Using the MegaMillions data, there are 10,780 possible pairs of which 1503 are unique over the lottery’s lifetime. In the current version of MegaMillions, there are 2330 possible pairs of which 1202 are unique. Pairs of numbers occur quite frequently; 1426 pairs have occurred 10,703 times throughout the lottery’s lifetime compared with 692 pairs that have appeared 1820 times in since the fourth version of MegaMillions began.

The graph at right shows that in the current version of MegaMillions, pairs of numbers win repeatedly quite often. Over the lottery’s lifetime, particular pairs have won very regularly.

There are ten combinations of ball triples: [1 2 3], [1 2 4], [1 2 5], [1 3 4], [1 3 5], [1 4 5], [2 3 4], [2 3 5], [2 4 5], & [3 4 5]. There are 10,780 possible triples of which 8675 are unique over the lottery’s lifetime. Within the past version of MegaMillions, there are 2330 possible triples of which 2245 are unique. 1789 sets of triplets have repeated 3894 times in the lifetime of the lottery. Five sets of triplets have occurred five times and two sets of triplets have occurred six times. In the past year, however, only twenty-three sets of three balls have repeated twice.

There have been many repeat winning combinations of three numbers in the lifetime of the lottery, although it is a less frequent phenomenon in the current version.

In the graph to the right, there have been many repeat winning combinations of three numbers in the lifetime of the lottery, although it is a less frequent phenomenon in the current version.


There are five combinations of ball quadruples: [1 2 3 4], [1 2 3 5], [1 2 4 5], [1 3 4 5], & [2 3 4 5]. There are 5390 possible quadruplets of which 5328 are unique over the lottery’s lifetime. Since June 22, 2005 there are 1165 unique combinations of possible quadruplets. Sixty-two sets of four numbers have repeated twice since MegaMillions began. There have been zero sets of quadruplets winning more than once in the current version of MegaMillions.

There is only one combination of ball quintuples: [1 2 3 4 5]. Only one set of five numbers has ever repeated twice in the history of MegaMillions: (11, 14, 18, 33, 48).
Common Differences Between Winning Numbers

A natural extension of analyzing number groups was to identify the trends by which numbers differ from one another. For example, while probability gives the numbers 20, 21, 22, 23 and 24 the same chance of appearing as any other combination, is it likely? The numbers for the most recent version of MegaMillions were scrutinized to determine if there is a common difference between each ball.


The graph depicts the difference between the 1st/2nd position, 2nd/3rd position, 3rd/4th position and 4th/5th position. Overall, each split differs by an average of nine (indicated by intersecting zero). 70% of the difference distribution lie between 1 and 20. While it is unlikely for the entire series to have peculiar (tight or very wide) differences, it is not necessarily an unusual situation. Since 2005, there have been twenty-six occasions where two subsequent numbers have differed by more than 30.

Winning Number Frequency

Analyzing the distribution of numbers over time only provided half the picture in terms of any given number’s propensity towards winning. Another aspect to consider was the temporal frequency by which a number wins. For example, a number may have won on thirty occasions, but maybe they were all two years ago. To study this behavior, the time delta between each number’s appearance was cataloged to establish statistics for all numbers and for each number across the lifetime of the fourth version of MegaMillions. Then, the analysis was repeated using only the most recent six months of data to identify the cross section of numbers that win frequently consistently and which numbers are just a current flash in the pan.


This graph depicts the numbers with the shortest, average time between appearance since version four of MegaMillions began in 2005. Simply having a low average, however, is not a good indicator that a number occurs frequently. The blue line depicts the ratio of wins that occurred with a time delta below average. Numbers with a ratio above 50% are indicative of winning often in “clumps” whereas numbers below 50% represent a wider spread of win frequency. It should be noted, however, that low frequency “clumping” also comes with a corresponding dearth of appearance.


The six month graph replicates the logic found above on the lifetime graph, only this time restricted to winning numbers over the past six months. The intersecting cross section of frequently winning numbers represent those that not only win over time but those that have demonstrated a recent propensity for appearing often. Over six months, there is a span of numbers that have both a low delta of days between appearance ’’and’’ a high ratio of occurrences on a more frequent basis than average. Equally, a handful of the recent numbers have low ratios, indicating their average is skewed by bursts of low delta wins offset by many frequent gaps of significant length.


Interesting as these trends may be, they will not assist in making the odds of winning the MegaMillions lottery any better if the system is truly fair and random. However, in the event there is some peculiar factor skewing the ball selection such that any of these trends continue, a player stands a mildly better chance of winning a partial prize through the selection of weighted numbers.

1 “The Lottery is Rigged.” Uncoverer. Accessed October 2007 from http://www.uncoveror.com/lottery.htm.

2 Roland, Neil. “Mega Millions Lottery Jackpot Now Record $370 Million.” Bloomberg. Accessed October 2007 from http://www.bloomberg.com/apps/news?pid=20601103&sid=afUgc0t0u3hg&refer=us.

3 “How to Play: Play the game.” MegaMillions.com_. Accessed October 2007 from http://megamillions.com/howtoplay/play_game.aspgame.asp.

4 “About Us: Game History.” MegaMillions.com_. Accessed October 2007 from http://megamillions.com/aboutus/game_history.asphistory.asp.

5 New Jersey Lottery. Accessed September 2007 from http://www.state.nj.us/lottery/data/big.dat.

6 Microsoft SQL Server Express. Accessed September 2007 from http://www.microsoft.com/sql/editions/express/default.mspx.

7 Ultimately, order does not matter with lottery numbers.


Red Light……Green Light….Red Light! Gotcha!

Challenges to red light cameras span US
Studies touting safety benefits sometimes contradictory, incomplete

By Alex Johnson Reporter

In more than 500 cities and towns in 25 states, silent sentries keep watch over intersections, snapping photos and shooting video of drivers who run red lights. The cameras are on the job in metropolises like Houston and Chicago and in small towns like Selmer, Tenn., population 4,700, where a single camera setup monitors traffic at the intersection of U.S. Highway 64 and Mulberry Avenue.

One of the places is Los Angeles, where, if the Police Commission gets its way, the red light cameras will have to come down in a few weeks. That puts the nation’s second-largest city at the leading edge of an anti-camera movement that appears to have been gaining traction across the country in recent weeks.

A City Council committee is considering whether to continue the city’s camera contract over the objections of the commission, which voted unanimously to remove the camera system, which shoots video of cars running red lights at 32 of the city’s thousands of intersections. The private Arizona company that installed the cameras and runs the program mails off $446 tickets to their registered owners.

The company’s contract will expire at the end of July if the council can’t reach a final agreement to renew it.

Opponents of the cameras often argue that they are really just revenue engines for struggling cities and towns, silently dinging motorists for mostly minor infractions. And while guidelines issued by the National Highway Traffic Safety Administration say revenue is an invalid justification for the use of the eyes in the sky (see box at right), camera-generated citations do spin off a lot of money in many cities — the nearly 400 cameras in Chicago, for example, generated more than $64 million in 2009, the last year for which complete figures were available.

Los Angeles hasn’t been so lucky.

The city gets only a third of the revenue generated by camera citations, many of which go unpaid anyway because judges refuse to enforce them, the city controller’s office reported last year. It found in an audit that if you add it all up, operating the cameras has cost $1 million to $1.5 million a year more than they’ve generated in fines, even as “the program has not been able to document conclusively an increase in public safety.”

Federal camera guidelines

The Federal Highway Traffic Safety Administration says red light cameras and other automated traffic controls should:

• Reduce the frequency of violations.

• Maximize safety improvements with the most efficient use of resources.

• Maximize public awareness and approval.

• Maximize perceived likelihood that violators will be caught.

• Enhance the capabilities of traffic law enforcement and supplement, rather than replace, traffic stops by officers.

• Emphasize deterrence rather than punishment.

• Emphasize safety rather than revenue generation.

• Maintain program transparency by educating the public about program operations and be prepared to explain and justify decisions that affect program operations.

Source: Speed Enforcement Camera Systems Operational Guidelines, Federal Highway Traffic Safety Administration

Another common refrain from critics is that the devices replace a human officer’s judgment and discretion with the cold, unforgiving algorithms of a machine.

“You’ve got to treat people fairly,”
said Jay Beeber, executive director of Safer Streets LA, who has led the campaign to kill the city’s red light cameras. “You have to give people a fighting chance that you’re not going to penalize them for a minor lapse of judgment.”

Paul Kubosh, a lawyer who has led a similar anti-camera fight in Houston, called the camera systems “a scam on the public,” because they “are writing tickets that police officers don’t write.”

There’s a fierce court battle going on in Houston, the nation’s fourth-largest city, after a U.S. district judge this week ruled that a measure voters approved to shut down the city’s more than 70 cameras was invalid on procedural grounds.

Could hundreds of lives be saved?

More than a dozen large studies over the past decade have concluded that the cameras reduce accidents and injuries. The most recent, published in February by the Insurance Institute for Highway Safety, crunched 10 years of federal traffic data for the 99 largest U.S. cities — 14 of which now deploy cameras — and calculated that had all 99 installed the devices, 815 lives would have been saved from 2004 through 2008.

We still have thousands of people who die,” said Adrian Lund, the Insurance Institute’s president. “We look at where and how that’s happening, and one of the most dangerous (locations) is intersections.”

Citing reports like that, the U.S. Conference of Mayors, which coincidentally is headed by Los Angeles Mayor Antonio Villaraigosa, this week approved a resolution endorsing nationwide adoption of red light cameras.

And yet, in addition to the votes in Los Angeles and Houston:

The Albuquerque, N.M., City Council voted this month to let residents vote on the future of the city’s 20 red light cameras in October. (City lawyers are still weighing whether the vote would have any official effect.)
In May, a Missouri circuit judge issued a preliminary ruling saying the measure that authorized St. Louis’ 51 cameras was illegally enacted.
Tennessee Gov. Bill Haslam said he would sign a bill the Legislature passed last month to limit — though not ban outright — localities’ use of cameras at intersections.
The North Carolina Senate voted in April to ban cameras; the measure awaits House action.
The Florida House passed a bill last month to ban red light cameras; the measure failed in the Senate.
A Superior Court judge last week struck down the law that enacted use of cameras in Spokane, Wash., agreeing that citations generated by the cameras were invalid because they were not personally signed by a police officer.

Often, the cameras lead to fines — and depending on the jurisdiction, costly points on drivers’ records — for borderline infractions like failing to come to a complete stop before making a right turn. (That infraction makes up two-thirds of the citations issued at camera-monitored intersections in Los Angeles, even though it rarely leads to an accident, the controller’s audit reported.)

Other common complaints are that the automated citations violate due process and equal protection rights — often, there’s no officer to confront in court — and invade motorists’ privacy.
Challenges to red light cameras

Besides questions about the reliability of safety research and the use of cameras as revenue generators, challenges to the devices have raised these issues:

Due process and equal protection. Defendants have argued that enforcement is selective because not all violators receive tickets, that assuming the driver is also the owner shifts the burden of proof from prosecutors to defendants, that different punishments for tickets issued by a machine and by an officer violate the 14th Amendment, that delays in processing and sending out tickets violate due process protections and that warning signs are frequently unclear or incorrectly placed.

Search and seizure. At least two lawsuits have argued that issuing a citation based on a photograph amounts to an unconstitutional seizure of the vehicle.

Privacy. While some anti-camera advocates argue that the cameras are an invasion of privacy, no such challenges have been raised in court, according to research by Carlos Sun, a lawyer and engineering professor at the University of Missouri, who writes: “Driving is a regulated activity on public roads. By obtaining a license, a motorist agrees to abide by certain rules including, for example, to obey traffic signals.”

Sources: msnbc.com research; “Is Robocop a Cash Cow?” (Carlos Sun, University of Missouri, November 2010)

Leslie Blakey, executive director of the nonprofit Campaign to Stop Red Light Running, which advocates for red light cameras, said opponents have fought the devices since they started taking root about a decade ago. She broke the opposition down into two camps: “civil libertarians who resist the imposition of automated enforcement” and “people who got tickets and just don’t like it.”

Beeber, of Safer Streets LA, agreed that “as more people get tickets, they start getting mad about it,” saying: “You start doing that year after year after year and you start generating enough anger in the populace and it gets to the tipping point.”

What’s changed in the last couple of years, Blakey said, is the “ability of people to organize online and form communities and organize actions that are well-orchestrated” on sites like Facebook and Twitter.

These things are becoming more and more useful to a small minority of people who want to mount an action against anything,” she said.

In response, Blakey’s group points to the Insurance Institute study and others like it that conclude the “red light cameras lead to significant decreases in intersection violations and crashes.”

Large studies produce wide range of results
This is where things get muddy, because hard research on the effect of red light cameras in the United States is incomplete and often contradictory.

That includes the widely reported Insurance Institute study from February. Like nearly all other studies over the past decade, that report found a significant decline in deaths from red light accidents in cities that use cameras. But deaths from U.S. roadway accidents of all kinds have dropped significantly — by 13.1 percent — during the study period of 2004 through 2008, data from the Federal Highway Traffic Safety Administration show.