Analyzing Betting (Keno) in Mathematica [closed]

Keno is a popular lottery game that is available with all of the larger casino softwares. The player is given a ticket with 70 numbers on it. He picks 1 to 11 numbers on the ticket. 20 winning numbers are selected randomly. The more of the player’s picks that are selected, the bigger the payout.

In Sweden, my home country, Svenska Spel (a state owned company) offers the following
Number of Correct GuessesReturnAverage Chance of Winning115000000See below101250009300083007306105540302010001 to 6.2Number of Correct Guesses11109876543210Return500000012500030003003010500000Average Chance of WinningSee below1 to 6.2\begin{array}{c|c|c|}
\text{Number of Correct Guesses}&\text{Return} &\text{Average Chance of Winning} \\ \hline
11 & 5000000 &\text{See below} \\ \hline 10 &125000 & \\ \hline9 & 3000 & \\ \hline8 & 300 & \\ \hline 7 & 30 & \\ \hline 6 & 10 & \\ \hline 5 & 5 & \\ \hline 4 & 0 & \\ \hline 3 & 0 & \\ \hline 2 &0 & \\ \hline 1 & 0 & \\ \hline 0 & 0 & \text{1 to 6.2}
\end{array}

What I would like to do is to calculate the probability to obtain 0,1,2,…,110,1,2,\dots, 11 right guesses on Keno 11 and compare it to Svenska spel. In addition, I would like to plot this result using histograms.

My Take

What I have done is to define the hypergeometric probability distribution function as:

I have then used this to calculate the KenoOdds using the following code:

KenoOdds =
Table[MatrixForm[
Table[{g, k, Round[1/N[Urn[g, 70, 20, k]]] – 1}, {k, 0, g}]], {g,
4, 11}]

The problem is that the first code does not work; all I receive is this message “An unknown box name (Hold) was sent as the BoxForm for the expression. Check the format rules for the expression.” H

=================

=================

2

=================

You probably input something that looks like
\frac{\left(
\begin{array}{c}
\text{good} \\
\text{need} \\
\end{array}
\right) \left(
\begin{array}{c}
\text{draws}-\text{need} \\
\end{array}
\right)}{\left(
\begin{array}{c}
\text{draws} \\
\end{array}
\right)}

These however were not interpreted as binomial coefficients, but as column vectors (2 by 1 matrices). You can see this from the form of the expression you pasted here.

You are likely looking for

Mathematica does allow you to input something that looks like traditional mathematical notation and it can interpret some of it, but this is not reliable. Your case is a perfect example of why. Mathematica does in fact give a warning before evaluating a TraditionalForm input. Generally, TraditionalForm is more useful for reading output than for inputting new expressions.

monte carlo approach..

n = 1000000;
nchoice = 11;
nball = 70;
draws = 20;
{#[[1]], N[ #[[2]]/n]} & /@ Sort@Tally@Table[
Length@Intersection[
RandomSample[Range[nball], nchoice],
RandomSample[Range[nball], draws]
], {n}]

Compare with Szabolcs’ formula (which is just a tad faster.. )

0, 0.017371 0.0172627
1, 0.094738 0.0949448
2, 0.219235 0.219994
3, 0.283973 0.282849
4, 0.223563 0.223648
5, 0.113827 0.113857
6, 0.037821 0.0379524
7, 0.008278 0.00825053
8, 0.001096 0.00114103
9, 0.00009 0.0000950859
10, 8.*10^-6 4.26916*10^-6
11 — 7.76212*10^-8