Solution (source code)

= Solution

For $\ell=0$ the terminating even solution is constant; for $\ell=1$ the terminating odd solution is proportional to $x$. For $\ell=2$, the recurrence gives $a_2=-3a_0$; for $\ell=3$ it gives $a_3=-5a_1/3$. Imposing the <Legendre polynomial> normalization at $1$ yields
$$
\boxed{P_0(x)=1,\quad P_1(x)=x,\quad P_2(x)=\frac{3x^2-1}{2},\quad P_3(x)=\frac{5x^3-3x}{2}.}
$$