In Denmark, chance gambling is popular, very popular. In 2014 Danske Spil had net earnings of 1560 M dkk, which is roughly 229 M \$.

A significant part of this stems from Onsdags Lotto (Wednesday lottery).

### Onsdags Lotto, the numbers

To win the grand prize in Onsdags Lotto you need to hit all $r=6$ correct numbers on your ticket. These numbers are extracted using $n=48$ numbered balls. When the first number is drawn we thus have 48 possibilities, when the second number is drawn we have 47 possibilities and so on, until all 6 numbers have been drawn. We can thus calculate the chance of winning Onsdags lotto on a single ticket to be

$$_{n, r}C = \frac{n!}{(n-r)! \cdot r!} = 12271512$$

i.e. roughly 1 in 12 M.

We can now write a more general expression for the chance of winning starting with the probability of *losing* when taking into account the number of tickets per week, $g$, and number of weeks played, $w$.

$$_{n, r}^{g, w}C_{lose} = (1-(_{n, r}C)^{-g})^{w}$$

The final expression for *winning *(in percentages) then looks like

$$_{n, r}^{g, w}C_{\%} = 100 \cdot (1-_{n, r}^{g, w}C_{lose})$$

### Let's play

We start by buying a single lottery ticket in a weeks game. We can then calculate our winning chance to be

$$_{48, 6}^{1, 1}C_{\%} = 8.15 \cdot 10^{-6} \%$$

That is really not alot.

We now do this every week for 50 years where we use 52 weeks in a year

$$_{48, 6}^{1, 50 \cdot 52}C_{\%} = 0.021 \%$$

Again, not really good odds yet.

What if we happened to be immortal and did this for 1 M years?

$$_{48, 6}^{1, 1000000 \cdot 52}C_{\%} = 98.56 \%$$

That is more like it!

### Accumulated probability

Using the equations presented above we can calculate the probability for all years from 0 to 1 M. In Python this can done like so

`years = 1000000<br />year_all = np.arange(years)<br />win_chance = np.empty(years)<br /><br />win_chance = 100*(1-(chance**(year_all*52)))`

Plotting this result in the figure seen below.

**Years played on the x-axis and accumulated chance of winning on the y-axis.**

### Playing until 25 % chance

A million years is a long time though, what if we just settled for getting 25 % chance of winning. How many years should we play to reach that?

We can extract this information from the plot above using this command in Python

`def find_nearest_ind(array, value):<br /> near_search = np.abs(array-value)<br /> idx = (near_search).argmin()<br /> return idx<br /><br />find_nearest_ind(win_chance,25))`

This returns a value of 67890 years to reach 25% chance of winning. Thats a lot less than 1 M years from before but still too much. If we instead buy 10000 lottery tickets per week we will be hitting 25% after just 7 years!

However, playing the lottery is not free so we have to take the expenses into account as well. A single Onsdags Lotto ticket cost 50 dkk or around 7 \$ and the typical grand prize is around 5 M dkk or roughly 0.73 M \$. We can thus write our net earnings as

$Net = Prize - Tickets$

$\ \ \ \ \ \ \ = 0.73 M \ \$ - 7 y \cdot 70000 \frac{\$}{week}$

$\ \ \ \ \ \ \ \approx -24.8 M \$$

I.e. we *lost* 24.8 M \$ or roughly 169 M dkk.

This is the reason *why you should not play the lottery.*

The full code for this post can be found at Github.