\[ a^2 y(x)-\cot (a x)+y''(x)=0 \] ✓ Mathematica : cpu = 0.0381168 (sec), leaf count = 48
DSolve[-Cot[a*x] + a^2*y[x] + Derivative[2][y][x] == 0,y[x],x]
\[\left \{\left \{y(x)\to -\frac {\sin (a x) \left (\log \left (\cos \left (\frac {a x}{2}\right )\right )-\log \left (\sin \left (\frac {a x}{2}\right )\right )\right )}{a^2}+c_1 \cos (a x)+c_2 \sin (a x)\right \}\right \}\] ✓ Maple : cpu = 0.105 (sec), leaf count = 41
dsolve(diff(diff(y(x),x),x)+a^2*y(x)-cot(a*x)=0,y(x))
\[y \left (x \right ) = \sin \left (a x \right ) c_{2}+\cos \left (a x \right ) c_{1}+\frac {\sin \left (a x \right ) \ln \left (\frac {1-\cos \left (a x \right )}{\sin \left (a x \right )}\right )}{a^{2}}\]