# Calculate the odd of winning Powerball in R

**One Tip Per Day**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This Wednesday’s Powerball grand prize already climbed up to $1.5 BILLION. If you choose to cash out, it would be $930 million. And it keeps increasing…

So, what’s the odd of winning the jackpot prize?

Here is the game rule according to Powerball.com:

…we draw five white balls out of a drum with 69 balls and one red ball

out of a drum with 26 red balls.

We can calculate the total number of different combinations in R:

> choose(69,5)*26 [1] 292201338

If we are super super lucky to win the Jackpot of $930 million cash value, given that we have to pay 39.6% as federal tax, how much we expect to return for a $2 investment? (Of course, everyone expect to win the $1.5 billion jackpot)

> 930e6*(1-0.396)/(choose(69,5)*26) [1] 1.92

Actually it’s not a good investment. (Thanks for the comment below. I made a mistake; 930million should be 930e6, not 930e9).

If we want to be 100% guaranteed, we have to buy all 292 million combinations. In that case, can we earn?

# this is what we pay > choose(69,5)*26*2 [1] 584,402,676 # this is what we earn in total, before tax > 930000000 + 1000000*choose(25,1) + 50000*choose(5,4)*choose(69-5,1) + 100*choose(5,4)*choose(69-5,1)*choose(25,1) + 100*choose(5,3)*choose(69-5,2) + 7*choose(5,3)*choose(69-5,2)*choose(25,1) + 7*choose(5,2)*choose(69-5,3) + 4*choose(5,1)*choose(69-5,4) + 4*choose(69-5,5) [1] 1,023,466,048 # Nearly $5 billion!!! Then we need to pay 40% of tax. Maybe not for the minor prize, let's simplify it for all. > 1023466048 * (1-0.396) [1] 618,173,493

That’s still more than what we paid. Why don’t we do that?

Remember, people share the prize if multiple persons got the same winning number, which we don’t know. 😀

Just some fun! 🙂

References:

1. Fascinating Math Behind Why You Won’t Win Powerball

(http://www.wired.com/2016/01/the-fascinating-math-behind-why-you-wont-win-powerball/)

2. Tax for lottery (http://classroom.synonym.com/much-federal-taxes-held-lottery-winnings-20644.html)

**leave a comment**for the author, please follow the link and comment on their blog:

**One Tip Per Day**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.