Solution (source code)

= Solution

The product of reflections in two lines meeting at angle $\theta$ is a rotation through $2\theta$. Here $Q=-R_{|\Omega\rangle}R_g$ rotates toward the good axis by $2\theta$. Since $|\Omega\rangle$ initially makes angle $\theta$ with the bad axis,
$$
Q^k|\Omega\rangle
=\sin((2k+1)\theta)|\psi_g\rangle
 +\cos((2k+1)\theta)|\psi_b\rangle.
$$
A single use replaces the angle $\theta$ by $3\theta$.