What is the optimal number of dice to roll a Yahtzee in one roll?
By inclusion-exclusion, the full probability of Yahtzee is: $$\frac{1}{6^n}\sum_{k=1}^{\min(6,n/5)} (-1)^{k+1} \binom{6}{k} (6-k)^{n-5k} \prod_{j=0}^{k-1} \binom{n-5j}{5}.$$ If you prefer, write the product with a multinomial: $$\prod_{j=0}^{k-1} \binom{n-5j}{5}=\binom{n}{5k}\binom{5k}{5,\dots,5}.$$ Looks like $n=29$ is the uniquely optimal number of dice: \begin{matrix} n &p\\ \hline 28 &0.71591452705020 \\ 29 &0.71810623718825 \\ 30 &0.71770441391497 \\ \end{matrix}
Here is the SAS code I used:
proc optmodel;
set NSET = 1..100;
num p {n in NSET} =
(1/6^n) * sum {k in 1..min(6,n/5)} (-1)^(k+1)
* comb(6,k) * (if k = 6 and n = 5*k then 1 else (6-k)^(n-5*k))
* prod {j in 0..k-1} comb(n-5*j,5);
print p best20.;
create data outdata from [n] p;
quit;
proc sgplot data=outdata;
scatter x=n y=p;
refline 29 / axis=x;
xaxis values=(0 20 29 40 60 80 100);
run;
As an alternative approach, we can use the symbolic method to deduce that the generating function for the class of all rolls not containing a Yahtzee is given by
$$ f(z) = (e^z - z^5/5!)^6 $$
while the generating function for all rolls is
$$ g(z) = (e^z)^6. $$
The probability that a roll of $n$ dice yields a Yahtzee is given by
$$ 1-[z^n]f(z)/[z^n]g(z). $$
Using Mathematica:
f[z_] := (Exp[z] - z^5/5!)^6;
g[z_] := Exp[z]^6;
ans[n_] :=
1 - SeriesCoefficient[f[z], {z, 0, n}]/
SeriesCoefficient[g[z], {z, 0, n}];
DiscretePlot[ans[n], {n, 10, 40}]