When throwing a die $3$ times, what is the probability of the product of the three results being a multiple of $9$? When throwing a die $3$ times, find the probability of the product of the three results being a multiple of $9$.
I tried drawing a table for the possible outcomes of the first TWO dice. Then I tried considering the cases for each when the third die is rolled - as you can imagine not very efficient. Perhaps I could use $x+y+z = 9k$ as a divisibility test, where $k$ is an integer. I'm pretty sure this would involve stars and bars, but I'm not sure how to implement it in this case. Would I have to solve for $k$?
I also worked out the boundaries but I'm not sure if that will help either: $9≤x+y+z≤216$.
Do I need to use stars and bars for this question?
 A: I do not agree with this solution.
I obtained the result $\frac{7}{27}$
In fact, the probability to have a product divisible by 9 means that, among 3 die's rolls, at least 2 must be #$3$ or #$6$, thus
$$\binom{3}{2}\left(\frac{1}{3}\right)^2\cdot\frac{2}{3}+\left(\frac{1}{3}\right)^3=\frac{7}{27}$$
A: You can solve it quickly by counting the cases when the product is not divisible by $9$.

*

*Number of all throws: $\color{blue}{6^3}$

*Number of throws containing neither $3$ nor $6$: $\color{blue}{4^3}$

*Number of throws containing exactly one $3$: $\color{blue}{3\cdot 4^2}$

*Number of throws containing exactly one $6$: $\color{blue}{3\cdot 4^2}$
Hence, the probability $P$ of a throw with a product divisible by $9$ is
$$P = \color{blue}{\frac{6^3-4^3 -3\cdot 4^2 - 3\cdot 4^2}{6^3}}= \frac{7}{27}$$
A: I agree with tommik's solution. Here is a simulation in R to verify.
# Number of simulations
nsims <- 1e7

roll <- function() sample(1:6, size=1)

# Generate products
products <- purrr::map_dbl(1:nsims, ~roll()*roll()*roll())

# Get proportion divisible by 9
sum((products %% 9) == 0) / nsims

0.2592488

which is about $\frac{7}{27} = 0.259259259...$
