\[ \sin ^2(x) y''(x)-y(x) \left (a \sin ^2(x)+(n-1) n\right )=0 \] ✓ Mathematica : cpu = 0.184523 (sec), leaf count = 65
\[\left \{\left \{y(x)\to \sqrt [4]{-\sin ^2(x)} \left (c_1 P_{i \sqrt {a}-\frac {1}{2}}^{n-\frac {1}{2}}(\cos (x))+c_2 Q_{i \sqrt {a}-\frac {1}{2}}^{n-\frac {1}{2}}(\cos (x))\right )\right \}\right \}\]
✓ Maple : cpu = 0.325 (sec), leaf count = 120
\[ \left \{ y \left ( x \right ) ={1 \left ( {\frac {\cos \left ( 2\,x \right ) }{2}}-{\frac {1}{2}} \right ) ^{{\frac {n}{2}}} \left ( \sqrt [4]{-2\,\cos \left ( 2\,x \right ) +2}{\mbox {$_2$F$_1$}({\frac {1}{2}}+{\frac {i}{2}}\sqrt {a}+{\frac {n}{2}},{\frac {1}{2}}-{\frac {i}{2}}\sqrt {a}+{\frac {n}{2}};\,{\frac {3}{2}};\,{\frac {\cos \left ( 2\,x \right ) }{2}}+{\frac {1}{2}})} \left ( 2\,\cos \left ( 2\,x \right ) +2 \right ) ^{{\frac {3}{4}}}{\it \_C2}+\sqrt {\sin \left ( 2\,x \right ) }{\mbox {$_2$F$_1$}({\frac {n}{2}}+{\frac {i}{2}}\sqrt {a},{\frac {n}{2}}-{\frac {i}{2}}\sqrt {a};\,{\frac {1}{2}};\,{\frac {\cos \left ( 2\,x \right ) }{2}}+{\frac {1}{2}})}{\it \_C1} \right ) {\frac {1}{\sqrt {\sin \left ( 2\,x \right ) }}}} \right \} \]