What is the probability of getting yahtzee?
What follows is a solution to a smaller problem; I don't have a good way to determine the probabilities of exactly k of some kind being the most of any kind on the first roll, but the work below could be used from that point to get an answer.
Let $f(N,X,Y)$ be the probability of getting all 1s with N dice, each with X sides, in at most Y rolls, where after each roll, 1s are retained and only non-1 dice are re-rolled. Working 1 roll at a time, the first roll could have exactly $k=0,\dots,N$ 1s. The probability of exactly k 1s in a single roll is ${N\choose k}\left(\frac{1}{X}\right)^k\left(\frac{x-1}{x}\right)^{N-k}$ and having k 1s in the first roll, we then need $N-k$ 1s in the remaining $Y-1$ rolls. So,
$$f(N,X,Y)=\sum_{k=0}^{N}{N\choose k}\left(\frac{1}{X}\right)^k\left(\frac{x-1}{x}\right)^{N-k}f(N-k,X,Y-1).$$
Also, the probability of all 1s on 0 dice is 1 (0 of the 0 dice are guaranteed to be 1), so $f(0,X,Y)=1$, and the probability of all 1s on $N\ge 0$ dice in 0 rolls is 0 (can't get any 1s without rolling some dice), so $f(N,X,0)=0$ for $N\ge 0$. This is a complete definition of $f(N,X,Y)$, though it does not lend itself to easy computation. (However, software like Mathematica may be able to compute from this definition. In Mathematica: f[n_, x_, y_] := If[n == 0, 1, If[y == 0, 0,
Sum[
Binomial[n, k]*(1/x)^k*(1 - 1/x)^(n - k)*f[n - k, x, y - 1],
{k, 0, n}]]]
.)
According to Wikipedia "the probability of a Yahtzee for any three-roll turn is about 0.04603 (or $\frac{347897}{7558272}$), or roughly 1 in 22 attempts."