\[ \left (n^2-a^2\right ) y(x)+2 n \cot (x) y'(x)+y''(x)=0 \] ✓ Mathematica : cpu = 0.173468 (sec), leaf count = 83
\[\left \{\left \{y(x)\to \left (-\sin ^2(x)\right )^{\frac {1}{4}-\frac {n}{2}} \left (c_1 P_{\sqrt {2 n^2-a^2}-\frac {1}{2}}^{n-\frac {1}{2}}(\cos (x))+c_2 Q_{\sqrt {2 n^2-a^2}-\frac {1}{2}}^{n-\frac {1}{2}}(\cos (x))\right )\right \}\right \}\]
✓ Maple : cpu = 0.532 (sec), leaf count = 60
\[ \left \{ y \left ( x \right ) = \left ( \sin \left ( x \right ) \right ) ^{-n+{\frac {1}{2}}} \left ( {\it LegendreP} \left ( -{\frac {1}{2}}+\sqrt {-{a}^{2}+2\,{n}^{2}},n-{\frac {1}{2}},\cos \left ( x \right ) \right ) {\it \_C1}+{\it LegendreQ} \left ( -{\frac {1}{2}}+\sqrt {-{a}^{2}+2\,{n}^{2}},n-{\frac {1}{2}},\cos \left ( x \right ) \right ) {\it \_C2} \right ) \right \} \]