\[ \sin ^2(x) y''(x)-y(x) \left (a \sin ^2(x)+(n-1) n\right )=0 \] ✓ Mathematica : cpu = 0.187965 (sec), leaf count = 90
\[\left \{\left \{y(x)\to c_1 \sqrt [4]{\cos ^2(x)-1} P_{\frac {1}{2} i \left (2 \sqrt {a}+i\right )}^{\frac {1}{2} (2 n-1)}(\cos (x))+c_2 \sqrt [4]{\cos ^2(x)-1} Q_{\frac {1}{2} i \left (2 \sqrt {a}+i\right )}^{\frac {1}{2} (2 n-1)}(\cos (x))\right \}\right \}\] ✓ Maple : cpu = 2.179 (sec), leaf count = 120
\[ \left \{ y \left ( x \right ) ={ \left ( {\frac {\cos \left ( 2\,x \right ) }{2}}-{\frac {1}{2}} \right ) ^{{\frac {n}{2}}} \left ( {\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}}}\sqrt [4]{-2\,\cos \left ( 2\,x \right ) +2}{\it \_C2}+{\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}})}\sqrt {\sin \left ( 2\,x \right ) }{\it \_C1} \right ) {\frac {1}{\sqrt {\sin \left ( 2\,x \right ) }}}} \right \} \]