Showing posts with label how to. Show all posts
Showing posts with label how to. Show all posts

27 June 2010

Odds of Winning the Lottery

I received a newsletter from a prominent financial and risk services firm where it was stated that the odds of winning the lotto are:

  1. 0,0000072 % with an average pay-out of R2,25 million

  2. The chances of picking five correct balls and one correct bonus ball are only slightly better at 0,000429 %, with an average payout of R173 130,22

  3. Not playing could make you R804 000 better off over your lifetime


This seemed a bit optimistic to me so I investigated the odds of winning the lottery while listening to Cryptopsy and Origin on the Jewtube Relapse Records channel.

How does probability work?


You divide the amount of desired outcomes by the total amount of possible outcomes. If you are casting a dice, you want one number out of six possible numbers. Thus, your odds of getting any one number of a dice are 1/6 or 0,166666667, times 100 to give you 16,6666667 %. For more on probability, see my Bayesian analysis post.

What are the chances of winning the lottery?


This problem could be sub-divided into a few smaller, easier problems using the infamous divide and conquer technique. These sub-problems are:

  1. How many balls are there in total?

  2. How many numbers are there?

  3. How do the combinations work?



How many balls are there in total?


In the South African lottery, or Lotto, there are 49 balls in total. That is, you start off with 49 balls.

How many numbers are there?


The South African lottery has six numbers, plus a bonus ball. Someone who guesses the first six numbers correctly wins over someone who has six numbers correct that includes the bonus ball. For our purposes, I shall exclude the bonus ball because we definitely want the jackpot.

Upon drawing the first ball (or number), there are 49 balls in the pool. You desire one ball out of 49 possible balls (though most guys prefer having two balls, but that's another story). Your odds of drawing this number are 1/49 or 0,020408163.

After the first ball is drawn, there is one less ball in the pool. This means that your odds of drawing the second ball are 1/(49 – 1) , which is 1/48 or 0,020833333.

When drawing the third ball, there are 47 balls left in the pool. This means that your odds of drawing the third ball are 1/47 or 0,021276596.

You get the picture. We can work out the chances of drawing all six balls in a similar way. Since drawing each ball does not depend on drawing a previous ball and we already compensated for having less balls at each round, the event of drawing any ball is discrete. Having discrete balls is awesome because we can multiply each ball event with each other to get the total chances of drawing 6 correct balls. The result is:

1/49 x 1/48 x 1/47 x 1/46 x 1/45 x 1/44 = 1/10068347520

Or one in 10068347520 possible numbers that can be constructed from six numbers each consisting of a number between one and 49.

How do the combinations work?


In order to win the South African Lotto, you do not need to guess the numbers in the correct order. This means any combination of the six numbers could win you the Lotto. In order to work out the number of combinations, we need to work with factorials.

Since there six possible numbers, we need to know how many combinations of six numbers we can possibly have. In other words, in how many different ways may you choose six numbers? This is the factorial of six, or 6!. The answer is 720.

What are the chances of winning the lotto?


The chances or odds of winning the South African lottery or Lotto are one over the total number of possible numbers divided by the total number of combinations of six numbers.

This means your chances of winning the lotto are not even a snowball's hope in hell, but a snowflake's hope in hell. You really want the number? Ok, the answer is 1/13 983 816 or one in roughly fourteen million. Another way to express this is 0,000000072, times 100 to yield 0,0000072 %.

Back to the newsletter



  1. The chances of winning the lottery are not 0,0000072 % but 0,000000072. Update: which of course you have to multiply by 100 to get the percentage, so that's where the 0,0000072 % comes from. Mystery solved!

  2. Using the same method above, the chances of picking five correct numbers out of a possible five are 0,000000524, times 100 to give 0,0000524 %. I'm not sure how the bonus ball would impact this but it seems to me that picking 5 + 1 numbers amounts to picking six correct numbers, since the possible number of numbers and the possible number of combinations remain the same. Thus, provided that I am right, your chances of picking five numbers plus a bonus number are equal to the chances of picking six correct numbers, so that remains 0,0000072 %.

    If I am wrong and the correct answer is 5 correct numbers out of 6, then this becomes the combinations of 6 taken as 5. In other words, 6!/(5!), which is 720/120 or 6. Thus, your chances of picking 5 correct numbers out of a possible 6 are 0,000000429, times 100 to yield 0,0000429 %. Which has one more digit than their number, but it's closer so I guess this is the method that they used.

    I might also be wrong in that 6 combinations plus a bonus ball out of 7 balls were chosen for the original odds. In this case, the answer is the amount of combinations made with 7 numbers, divided by the factorial of 7 taken as 6. The answer is a 0,000000039 or 0,0000039 % chance of winning the Lotto with six correct numbers out of a possible seven, one of which is a bonus.

    This is a bit far from their estimate, so I guess they used the same method I used, except they got a few digits wrong. This might be due to the accuracy of the calculator or spreadsheet application that they used.

  3. The not playing figure assumes that ticket prices remain at R3,50. The playing time is 35 years (between the ages of 25 and 60). Interest is calculated annually at 10 %. This means that not playing Lotto and saving your change, if you played twice a week, yields the handsome sum of roughly R98 991,65 (I am uncertain if this is calculated at simple interest or at compound interest), which is nowhere near R804 000.

    I used a financial calculator, with the values as indicated. I assumed that one ticket is bought for each draw, meaning two draws per week. I multiplied this R7 with the amount of weeks in a year (roughly 52,178571429 weeks) which gave me a yearly investment of R365,25.

    In order to reach their amount of R804 000, you'd have to invest roughly R83 366,52 per year over a period of 35 years at 10 % interest. This amounts to spending roughly R1597,98 per week on the Lotto, which is about R800 per draw or 228 tickets per draw.


Apparently this is a miraculous financial and risk services firm because they can turn R96 552.43 into R804 000 over the same period and using the same interest. Guess I should consider investing with them.

Where do their numbers come from?


Their numbers and my numbers differ by a factor of 100. This is very peculiar, so I found this page on lottery maths that explains the difference.

In the first case, despite their statement that you only play twice per week, they must've bought a total of 100 tickets per lottery draw. This would increase the odds from 1 in nearly 14 million to 100 in nearly 14 million to win a six number lottery, without any bonus. Update: unless of course they were working in percentages, in which case their number is correct.

In the second case, they must've bought a total of 100 tickets per lottery draw. This would increase the odds a thousand times for a five ball plus bonus draw, which gives the ratio between our different numbers.

To put this in perspective, an ordinary calculator cannot even display the minute numbers in question. Regardless of whose method you use, you're likely to end up with 0. In other words, your odds of winning the lotto are as good as 0. The only way to have a noteworthy chance of winning the lotto is to buy a couple of million tickets per draw. But if you could buy a couple of million tickets per draw, you wouldn't need to win the lotto.

Lastly, I multiplied my weekly amount by 100 and worked out the future value of such an investment. This means instead of not spending R365,25 per year on the lottery, you don't spend 100 tickets per week x R3,50 per ticket x weeks in a year per year on the lottery. In other words, you invest this R18 262,5 per year for 35 years at a 10 % interest rate. This investment would be worth about R4 949 582.53 at the end of 35 years. This is again a far cry from R804 000, only this time I am missing about R4 145 582,53.

It appears that this financial and risk services firm does business like FIFA.

19 September 2009

Blocking Para Sites

My week hasn't gone particularly well. Firstly, my computer blew up in blue smoke. Then, my replacement computer ended up not being all that compatible with software I need to run for projects. There is also a distinct possibility that I may have swine flu. Some members of the Illiterati tried to mug me three times this week. I say try because there is circumstantial evidence that implicates me in assault and propagating hate speech. The lesson you learn from this is don't fuck with me. In more diplomatic terms, this rule is expressed as do unto others as you would like to be done unto yourself. Same thing, if expressed with more syntactic sugar. I don't like being fucked with, so I do my best not to fuck with other people. You get the idea.

What to do if a website fucks with you


Suggest that you have a particularly shitty ISP. Suggest that this ISP is called isturb. Suggest that isturb decided it's an anurism inducing brainwave idea to hijack your browser and redirect it when you've reached your cap. Suggest that it doesn't help to try and reason with their technical support because they are shaved apes trained to answer: "Eish hauwa I duno maybe you should buy more bandwidth?" to every query they get. The lives of homo habilis must be eventful, going from one angsty, vengeful, ranting nerd to the next, interspersed with the erratic lunch break or two.

Stop spam websites from hijacking your browser


Enough pointless rage for one day. Let's look at an amazingly blunt way to stop any website from hogging your precious bandwidth. The answer lies in your hosts file. More classy nerds than I have figured out bigger and better tricks by now. But seriously, my computer is just a fancy mp3 player, so this is what you and I can do to stop these cretins from fucking with us:

  1. Find your hosts file. This is not as hard as it sounds. Unfortunately, suggest that your ISP is so shitty that it doesn't provide software that runs on Linux. It claims that it supports Linux, but those half-baked jackasses would probably suggest to you to install wine and run an exe. Suggest that you are vendor-locked on Windows, find your hosts file here. Linux nerds will find their hosts file in the /etc/ directory.

  2. Ensure that you have the righs to edit your hosts file. Windows users: this means right clicking on the file, clicking on properties and unticking the box that says Read only. Open the hosts file in notepad or something similar. Linux nerds need no lecture on rights or where to find the hosts file on Linux.

  3. Edit your hosts file. After you identified the source of your peril, simply tell the source of your peril to redirect to your ass so it may kiss your ass. Your ass naturally lives in your home. In PC speak, home is 127.0.0.1. Suggest that the source of your ISP peril is www.isturb.co.za. This means you add the following line to your hosts file:

    127.0.0.1 isturb.co.za

    This line says home is the place where isturb may find your ass to kiss it. By the way, the first line in your hosts file is generally:

    127.0.0.1 localhost

    This wasn't in my hosts file, so I put it there. Seems to work better with this line.

  4. Save and close your hosts file. Don't be a bright spark and save it as a text file. The hosts file should have no extension. It should be hosts. Period.

  5. For the paranoid: Ensure that you don't have the rights to edit your hosts file. After you edited the hosts file, right click on it, select properties and tick the read only box again. This is probably not necessary until it's too late.


From now on, isturb will no longer redirect your browser to their spam infested hades. Nay, nay, from now on, whenever isturb tries to do that, your browser will redirect to some arb place hosted on your local computer. My other computers on the home network sometimes do funky google searches, or they simply give a 404. Bitchin. No more hogging my browser, hypothetical fucktards.

Update


Some websites, like the hypothetical isturb, might use slightly different URLs to try and spam you with their malware. To counter this, you might have to add the different URLs to your hosts file. In theory, you can add all the aliases for a particular IP address next to it in the hosts file, like this:

127.0.0.1 isturb.co.za www.isturb.co.za http://www.isturb.co.za/whatever.html

However, I found that it works better to use all the variants on separate lines in Windows XP, like this:

127.0.0.1 isturb.co.za
127.0.0.1 www.isturb.co.za
127.0.0.1 http://www.isturb.co.za/whatever.html

Note that there should be a space between the IP address and the URL. I use tabs just to make things neater. That seems to do the trick.

Google sucks piles I'm moving to Steemit

Short and sweet, Google isn't allowing me to post ads on my blogs here on blogspot any longer. Not that I provide my angry nerd rants fo...