paint-brush
Gaming the lottery: How one winner used math to overcome the oddsby@bryn_solomon
30,760 reads
30,760 reads

Gaming the lottery: How one winner used math to overcome the odds

by Bryn SolomonJanuary 6th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Each week for the last 6 years (2012–2018), I was playing the lottery to win. Not just <em>hoping </em>to win — playing with a ‘positive expected value’ (a mathematical expectation to win rather than lose, on average, over time). In June 2018 this particular window of opportunity closed, so I’ve decided to share more about the winning model and reveal some closely guarded secrets from the clandestine world of professional gambling.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Gaming the lottery: How one winner used math to overcome the odds
Bryn Solomon HackerNoon profile picture

Each week for the last 6 years (2012–2018), I was playing the lottery to win. Not just hoping to win — playing with a ‘positive expected value’ (a mathematical expectation to win rather than lose, on average, over time). In June 2018 this particular window of opportunity closed, so I’ve decided to share more about the winning model and reveal some closely guarded secrets from the clandestine world of professional gambling.

Oz Lotteries ‘Pools’ website one day after the game was discontinued

Winners walking among us

We’ve all heard the maxim ‘the house always wins’. This is typically true.

But how do we explain the MIT students or Michigan retirees who took home millions of dollars in the Massachusetts state lottery…many, many times? There were the Russian mathematicians who reverse engineered random number generators (pRNG) on slot machines. Or Ed Thorp and the blackjack teams who raided Las Vegas casinos. And who can forget the handful of horse bettors who became billionaires (yes, with a ‘b’) betting on races at the Hong Kong Jockey Club?

Where do these professional gamblers go to cut their teeth? How do they learn to beat these games of chance?

Famous betting syndicates won billions of dollars betting on horse races at the Hong Kong Jockey Club

The good news? There’s no college degree for this stuff — almost all of these players are self-taught hustlers. But they do their homework. Homework, and intentional practice. Spend enough time dreaming up ways to make money, pondering angles, probing for weak spots…with effort, time, and a dollop of luck, you’ll find a chink in the armour.

The other good news? Most of these games are governed by the laws of statistics. So with a (basic) understanding of math and probability, you too could be on the road to riches.

Origins

It was 2012, I was a couple years out of college and working as a derivatives trader in Hong Kong. Life was good! On Wednesday nights we would drink beer at the Happy Valley horse races, and on Summer weekends catch a ferry over to Macau (‘Vegas of the East’) to attend pool parties at the Hard Rock.

Macau casinos hosted Summer pool parties

In my spare time however, I was becoming increasingly fascinated by odds and statistics. I was captivated by games of probability, and the prizes at stake. After reading about Benter and his horse betting syndicate, I invested even more energy into studying and building winning betting models. Later that year I worked with a machine learning expert attempting to mimic these idols, hoping to achieve just a sliver of their success.

Field trip

One time, after reading Peter Liston’s book Million Dollar Slots, I was inspired to set out with a friend on a multi-week tour of every casino in Macau, searching for particular slot machines known as ‘limit jackpot mystery progressives’. For research, we:

  • Bought spy camera pens off Amazon

Spy camera pen used for filming slot machine reels

  • Filmed slot machine reels from our pocket while we played $0.01 spins
  • Shipped footage to a contractor on upwork to have them manually transcribe the information into a .csv file
  • Used the data to model the precise tipping point when a machine offered positive expected value

With research sorted, we returned the following weekend hoping for a conquest. The jackpot on each of our targeted slot machines had to grow, so we sat and waited for other players to do the work for us, each of their spins funneling more money into the jackpot and taking it closer to striking point. Eventually, after a grueling few hours, a machine shifted to a ‘ripe’ state. We pounced! And won…$50. Sadly, while this was a ‘successful’ venture, the return on time wasn’t attractive enough to warrant a repeat visit.

Scaling up

The Hong Kong Jockey Club is an organisation that has a government endorsed monopoly on gaming (much like the state governments in the US). They run a lottery called Mark Six, with an egregiously high commission (the amount the house keeps as their ‘fee’ before the prizes are awarded) of 46%. FORTY-SIX-PERCENT! Yet punters keep coming back to play Mark Six, week in, week out.

Witnessing such large-scale irrational behaviour from the public reinforced my existing belief that there must be a way for me to get a piece of the action. But how? I needed to look closer at the lottery. But not just Mark Six…every lottery.

Lotteries around the world

The lottery project was so intriguing I got straight to work. Using the undefeated combination of Google and Wikipedia, I began compiling a list of large lotteries around the world. I would perform cursory research on each of the games, and rank them based on:

  1. Probability of being beatable. All the vanilla ‘draw n balls from a barrel’ type lotteries have well known calculations. It’s very quickly apparent which have attractive ticket price vs chance of winning (spoiler: none). Exotic or non-random games (games that are not based on pure luck) are hugely more attractive
  2. Ease of access. Even if I did find a lottery that was attractive, would I be able to buy tickets? Did I need to be a citizen? Do I have friends in the country who could execute on my behalf?
  3. Likelihood of corruption. That is, some lotteries are probably not truly ‘random’. Call it cynical (or realistic), but I am typically very quick to assume corruption. It’s simply not possible to win a lottery that is pre-selected for the governor’s cousin’s best friend.

And then, right there in Australia, the game that caught my eye…

Tatts Pools

Tatts Pools was based on the classic skill-based British game football pools (‘soccer’ for the unwashed). On the surface it appeared to be a standard lottery with 6 random numbers being selected from 38 choices (38 choose 6). It had a major jackpot that snowballed if there were no winners, and a range of smaller secondary prizes. However there was a twist. The selected numbers were not completely random, rather determined based on results of scheduled European football matches.

Pools match list for determining winning numbers

Taking a deep dive into the game rules, I emerged with the following important information:

  • Each scheduled match was given an arbitrary match number. For example, in the image above Manchester United vs Arsenal is match #3.
  • The matches were played, and ranked according to their result. The ranking criteria had 3 parts :
  1. Draw > Away team win > Home team win

2. If more than one match shared the same result, more goals scored > less goals scored. For example, 2–2 draw > 0–0 draw

3. If results were identical, the match with a higher match number was selected. For example, if two matches were 2–2 draws, match #32 > match #5

  • Finally, after matches were played and ranked according to the above 3 steps, the match numbers of the top 6 ranked matches were deemed the winning lottery numbers.

Tatts Pools lottery result based on highest ranked football matches

At this point, if you’re a professional gambler, you may already feel the tingle. Let’s walk through the ranking criteria again, with some insight into the thought process:

  1. Draw > Away team win > Home team win

Reaction: OK, sure. Are any of these more probable than others, on average? Need to check data.

2. If more than one match shared the same result, more goals scored > less goals scored. For example, 2–2 draw > 0–0 draw

Reaction: OK, sure. Again, need high level look at data to observe distribution of match scores.

3. If results were identical, the match with a higher match number was selected. For example, if two matches were 2–2 draws, match #32 > match #5

Reaction: OK, su…wait WHAT!? At this point I am jumping out of my boots. A basic familiarity with football scores tells us that the scores are often very low, and therefore frequently the same. eg common scores are {0:0, 1:0, 0:1, 1:1}. So if 38 matches are played, the chance that many of the results are precisely the same is very high. Which will then trigger this clause, forcing all the highest ranked matches (winning lottery numbers) to simply be the matches with high match numbers

With the above logic alone, I probably already had a small positive expectancy (enough to start beating the game). But it was time to dig deeper…

A little help from my friends (at Ladbrokes)

The next logical step was to transition from high level -> low level data analysis. Specifically, instead of treating all of the football matches according to large sample averages, there was additional information I could use- I knew exactly which teams were playing each other, and could get information about these teams! For example, in the Premier League, Manchester City (strong team) was likely to beat Huddersfield (weak team). This made a draw, a result that ranked highly according to the ranking criteria, unlikely. Conversely, Manchester City vs Liverpool was a close match that increased the chance of a draw.

I was now faced with 2 choices:

  1. Build a model to predict football scores (some inputs might be statistics about teams’ winning record, goals scored, corner kicks, player injuries etc) (difficult).

or

2. Let other people build the model for me (smart). There was already a multi-billion dollar football betting industry in Europe, with hundreds of bookmakers pricing the outcomes of each match every week. With enough financial incentive + sophistication in a market, wisdom of the crowd should dictate that on average, bookmaker odds will be a reasonably accurate estimate of each match result. No need to over complicate things — this information was available and free.

oddschecker.com’s football bookmaker aggregator

The model

So now I had some parameters with which to construct a model. Exactly how could I estimate how likely matches were to be highest ranked (and therefore winning lottery numbers)?

Broadly speaking, mathematical solutions can be derived analytically (exact solution, with a pencil and paper, eg solving an algebraic equation), or estimated numerically (‘guess and check’ type methods, using computing power to arrive close to the true answer).

A model is a simplified version of reality, like a street map that shows you how to travel from one part of a city to another — Ed Thorp

The Pools problem was sufficiently complex that I determined the easiest approach would be numerical, arriving at an estimate through brute-force aka Monte-Carlo simulation. This involves:

  • Writing a computer program that knows the match ranking criteria.
  • Listing out all matches for the week and using bookmaker data to assign specific probabilities to each outcome (draw, home win, away win).
  • Simulating all the matches being played 500,000 times to arrive at an estimate of how likely each match is to fall within the top 6 ranked matches (and therefore be deemed a winning lottery number).

Probability each match is a winning lottery number from 2018-03-26. Note the sum of all columns = 600%, as there are 6 winning lottery numbers selected each week. Note also the positive slope toward the higher match numbers, courtesy of ranking criterion #3

Practical considerations

Finally, once I had estimates for which lottery numbers were likely to win, I had to deal with some real world hurdles such as expected value and execution (ticket purchasing). Concretely, how many lottery tickets do I purchase, and when, and how? Here are some relevant considerations:

  • Prize pool. Was the jackpot large enough to make it attractive to buy tickets this week? If not, need to sit tight, hope nobody wins, and the jackpot keeps snowballing.
  • Execution. Once I knew which matches were likely to be the winning numbers, I couldn’t just buy a single ticket with the top 6 choices. This would be exceedingly unlikely to win. I needed to buy every combination of 6 choices that I calculated to be positive expected value. Luckily Tatts Pools had a native combination ticket called ‘System 20’. This ticket was the equivalent of buying 38,760 individual tickets (20 choose 6) and cost $21,182 each week.

$21,182 System 20 Tatts Pools lottery tickets

  • Splitting. What was the probability other people would also win, and I’d need to split the prize? This would damage expected value. Using weekly ticket sales, I would look at the growth of the prize pool, back out how many tickets were sold that week, then use a Poisson distribution to estimate how many other winners I expected to split with.

Expected value drops off a cliff when a jackpot is split with other players

  • Other professionals. If anybody else had figured out the same edge and was operating a similar model / system, it would all but guarantee prize splitting and become an ugly proposition for both groups. Thankfully study of historical Pools prizes made it clear that there were no other players exploiting this edge.
  • Secondary prizes. There were secondary prizes awarded for tickets that correctly selected 5/6 and 4/6 of the winning numbers. I expected to win hundreds of these on any given week, so needed to factor this in as a discount to the ticket cost.
  • Bankroll. Any seasoned gambler is intimately familiar with the Kelly criterion and importance of bankroll management. On typical Pools weeks the probability of winning a jackpot with the model and a System 20 ticket was 5–7%. Because this is a rare event, I needed to be prepared to lose a substantial amount of money before emerging victorious.
  • Margin of error. As all bookmaker odds were simply estimates of true probability, it would be unwise to bet on a slim positive expected value. I needed to wait for a jackpot to be sufficiently large that there was a comfortable margin of error, such that even if bookmaker odds were incorrect, I should still be playing the game.

Results

The model described above was in production for 6 years. Jackpots were attractive infrequently, so aggressive plays (System 20) were made <50 times. While I won’t reveal the precise number of jackpots or dollars won, I will say the bankroll draw down prior to a jackpot win was -$300k. This was running below expectation, but bad variance needs to be accepted in any probabilistic gambling system.

Conclusion

Reflecting on the opening proposition that ‘the house always wins’, I’d like to point out this is still intact. It’s important to realise that the loser in the Tatts Pools game was not Tatts, who routinely took their fee from ticket sales. The money funding the jackpots was coming from ticket sales. The losers were those unsophisticated players that contributed to the growing jackpot each week through random and sub-optimal ticket purchases.

This is true for almost all the examples of professional gambling mentioned in this article. If the house weren’t wining, they’d find out very quickly (it is their business to know these things after all). So most professional gamblers are typically sharing winnings with the house, extracted from non-professional players.

I’ll conclude by saying that in most standard lotteries, when you buy a ticket, you have an expected return of negative 50%. That is, for every $1 you spend on a lottery ticket, on average, you expect to receive only $0.50 in return. An innovative way to lighten your pocket. But with a little math, perhaps you can turn the tables and find that pot of gold at the end of the rainbow.

Want to chat more / have an interesting proposal? Contact me at [email protected]