$\begingroup$

You can bypass the cumbersome transition matrix method in this problem, and get a quicker explicit solution using generating functions and some algebra tricks.

Your goal is to count the number of 2s, 3s, and 5s that occur in the prime factorization $ (2^A 3^B 5^C)$ of the product of N rolls of a die. The exponents of these primes increase in an additive fashion with each roll. We can model this by treating the exponents $(A,B,C)$ as position vectors on a three-dimensional lattice.

Step 1. Each outcome of each roll of the die has a prime factorization, and has the incremental effect of shifting your position on the lattice by a displacement vector. Below we tabulate the possible outcomes of a roll of a die, and the exponents that occur in the prime factorization of the number rolled).

1: (0,0,0) 2:(1,0,0) 3:(0,1,0) 4:(2,0,0) 5:(0,0,1) 6:(1,1,0)

Since we want to keep track only of the parity of these exponents we can regard (2,0,0) as equivalent to (0,0,0). Note that there are now two ways to roll this null displacement vector, and one way to roll the other displacement vectors.

Step 2. We now use algebraic expressions as a notational device for modeling a displacement on a lattice. To each of the outcomes listed above we use its prime factorization to construct an associated algebraic expression. (Admittedly it seems like we are chasing our tails, toggling back and forth between additive and multiplicative descriptions of numbers, but be patient. ) :)

$1\to 2^0 3^0 5^0 \to a^0 b^ 0 c^0 $ (null displacement on exponent lattice)

$ 2\to 2^1 3^0 5^0 \to a^1 b^0 c^0 = a$

$\ldots$

$ 4\to 2^2 3^0 5^0 \to a^2 \to a^0$ (null displacement) because in our case we care only about parity on the exponent lattice

$\ldots$

$ 6\to a*b$

Step 3. Now we are ready to introduce generating functions! To account for all six outcomes of a dice roll, set $F(a,b,c)= 2+ a + b + a*b + c$ which correctly double-counts the null outcome. The magic of generating functions as a book-keeping device is that for example the 3rd power of the multivariable polynomial $F(a,b,c)$ tells you the number of ways that three rolls of the die can add up to a given displacement vector on the exponent lattice. That is, the expansion of the third power $F(a,b,c)^3=8 + 12 a + 6 a^2 + a^3 + 12 b + 24 a b + 15 a^2 b + 3 a^3 b + 6 b^2 + 15 a b^2 + 12 a^2 b^2 + 3 a^3 b^2 + b^3 + 3 a b^3 + 3 a^2 b^3 + a^3 b^3 + 12 c + 12 a c + 3 a^2 c + 12 b c + 18 a b c + 6 a^2 b c + 3 b^2 c + 6 a b^2 c + 3 a^2 b^2 c + 6 c^2 + 3 a c^2 + 3 b c^2 + 3 a b c^2 + c^3$

tells you that in three rolls there are $6$ ways to get the algebraic expression $a^2 b c$ (which corresponds to the displacement vector $(2,1,1)$ on the exponent lattice, which in turn corresponds to increasing the cumulative product of numbers rolled by the factor $2^2 \times 3 \times 5$.)

Now, since you want to keep track of the general $n_{th}$ power of $F(a,b,c)$ you can introduce the geometric series $g(a,b,c;t)= \frac{1}{ 1- t F} = 1+ t F+ t^2 F^2 + t^3 F^3 \ldots$ whose expansion in powers of $t$ consists of the powers of $F$.

Step 4. Recall that you want to lump together all lattice positions that have the same parity mod 2. A sneaky trick for accomplishing that "topological identification" of congruent lattice points is to symmetrize the function $g$ to make it even in each of the variables $(a,b,c)$, so that only even powers of $a,b,c$ occur in its Taylor expansion. This symmetrized function is an eight-term expression $S(a,b,c;t)= \frac{1}{8}[g(a,b,c;t)+ g(-a,b,c;t)+ g(a,b,c) + g( a,-b, c) +\ldots]$

In principle we could expand $8S(a,b,c;t) $ out as a Taylor series: $8 + 16 t + 8 (4 + a^2 + b^2 + a^2 b^2 + c^2) t^2 + (64 + 48 a^2 + 48 b^2 + 96 a^2 b^2 + 48 c^2) t^3 +\ldots$

but actually all we care about is the coefficient-weighted total number of different terms that occur for each power of $t$.

Step 5. This latter can be found by the simple trick of replacing $a=1, b=1, c=1$ which is a massive simplification. So go back and do that from the very beginning, where $g$ is introduced, repeat the symmetrization process, insert the numerical values $a=1,b=1,c=1$ and collect terms in an expression that now depends only on $t$. We see that $ 8 S(a,b,c;t) =3 + 1/(1 - 6 t) + 1/(1 - 4 t) + 3/(1 - 2 t)$.

Step 6. Now at last it is clear (by expanding the last expression in its geometric series) why you get the answer $\frac{6^n + 4^n + 3* 2^n}{8}$.