\[ \boxed { a{x}^{2} \left ( y \left ( x \right ) \right ) ^{n}{\frac {\rm d}{{\rm d}x}}y \left ( x \right ) -2\,x{\frac {\rm d}{{\rm d}x}}y \left ( x \right ) +y \left ( x \right ) =0} \]
Mathematica: cpu = 0.095012 (sec), leaf count = 42 \[ \text {Solve}\left [\frac {n \left (\log (x)-\log \left (-a x y(x)^n+n+2\right )\right )}{n+2}-\frac {2 n \log (y(x))}{n+2}=c_1,y(x)\right ] \]
Maple: cpu = 0.140 (sec), leaf count = 33 \[ \left \{ {\frac {{x}^{n}}{ \left ( \left ( y \left ( x \right ) \right ) ^{n}ax-n-2 \right ) ^{n} \left ( \left ( y \left ( x \right ) \right ) ^{n } \right ) ^{2}}}-{\it \_C1}=0 \right \} \]