✓ Mathematica : cpu = 0.0385486 (sec), leaf count = 25
DSolve[b*x^n + a*y[x] + x*Derivative[1][y][x] == 0,y[x],x]
✓ Maple : cpu = 0.019 (sec), leaf count = 23
dsolve(x*diff(y(x),x)+a*y(x)+b*x^n = 0,y(x))
Hand solution
Linear first order, exact, separable. \(y^{\prime }+\frac {ay}{x}=-bx^{n-1}\), integrating factor \(\mu =e^{\int \frac {a}{x}dx}=e^{a\ln x}=x^{a}\), hence
If \(a=-n\) then
If \(a\neq -n\) then
Verification
restart; ode:=x*diff(y(x),x)+a*y(x)+b*x^n=0; s1:=x^(-a)*(_C1-b*ln(x)); s2:=-b*(x^n/(a+n))+_C1*x^(-a); odetest(y(x)=s2,ode); 0