I was running a training session for new maths teachers last week and over lunch someone mentioned the weekend’s huge lottery draw, with the largest jackpot in UK lottery history of £66m, shared by two winners.  I remember when the National Lottery started, one of my first thoughts about it being, “if someone had enough money they could buy up every combination and guarantee the jackpot”.  We talked about this over our jacket potatoes with chilli and I started to consider the practicalities.  And, of course, the maths.  So here are my musings…

Let’s begin with the old system.  The lottery numbers went from 1 to 49, from which you chose 6 distinct numbers and paid £1.  The number of possible combinations of six numbers out of 49 is 13,983,816.  This is calculated using the rather nice formula:

\frac{49!}{6!43!}

where the ! is read “factorial” and 49! = 49×48×47×…×1 or multiply 49 by every other integer down to 1.  It’s surprisingly hard to find a good explanation of why this is the formula, I might do one myself one day, but not now.

The theory goes that you could buy 13,983,816 lottery tickets and be a guaranteed winner, so as long as the jackpot was more than £14m you’d make a profit.  How long would it take you to buy that many tickets?  Assuming you had a really sympathetic newsagent and very strong muscles in your hand you might be able to fill out one set of numbers and put it through the machine every 10 seconds.  That’s 139,838,160 seconds of ticket buying, or just short of 1618½ days.

Wow!  Even if you were allowed to buy your tickets 4½ years in advance, that’s not worth it for any amount of money.  So, my mind continued, what about if you were also a competent programmer and could write a script to buy your tickets online?  A cursory look at the lottery website shows me that you can buy up to 70 sets of numbers in one go, so your script has to run through all the combinations, buying them in clusters of 70.  Now I’m guessing that, provided you’re already logged in and there are no captcha or anti-bot systems running on the website (there probably are and this whole endeavour is rendered pointless, but hey-ho, I’m enjoying the numbers, let’s continue), the time to enter 70 sets of 6 numbers is minuscule and the limitation is only the website’s server speed in paying and loading pages.  Let’s go with 10 seconds per set of 70: that’s 1/70th of the time we came up with for buying in the newsagent’s, 1997688 seconds (I love that 70 is a factor of this massive number, but think about it – if 49 was a factor of our starting number, then so was 7, and it was also a multiple of 10), or just over 23 days.  Much more reasonable but still against the rules (you can only buy up to a week in advance).

Unfortunately for our hypothetical millionaire gambler, in 2015 Camelot changed the lottery.  The numbers now go from 1-59, giving us 45,057,474 possible combinations.  So we’d need over fourteen years at the newsagent’s, and our computer will take 74½ days.  Plus, each ticket costs £2, so unless the jackpot stands at over £90m you can forget the whole shebang.  Not to mention how annoyed you’d be if someone else shared the jackpot with you, especially if they’d only bought one ticket!

The moral of the story: if you fancy your chances with the lottery, don’t go outside ever.  Your chances of being hit by lightning are far greater, and you are clearly happy with taking a gamble on more than extremely unlikely events.*

* Apparently around 30 to 60 people are hit by lightning in the UK every year. With a population of 63 million, that’s a chance of anywhere between 1 in 1.05 million and 1 in 2.1 million.

Advertisements