Solution (source code)

= Solution

The same pole-order argument provides a <basis>
$$
\boxed{\{x^j:0\le2j\le n\}\ \cup\
\{yx^j:0\le3+2j\le n\}.}
$$
For $n\ge0$ the first set contains $\lfloor n/2\rfloor+1$ elements, and the second contains $\max(0,\lfloor(n-3)/2\rfloor+1)$. Distinct pole orders imply linear independence, and the coordinate-ring expression proves spanning. Hence
$$
\boxed{l(nP_\infty)=
\begin{cases}
0,&n<0,\\
1,&n=0,\\
n,&n\ge1.
\end{cases}}
$$
For $n<0$ a function in the space would have no poles anywhere and would vanish at infinity; a <regular function> on a projective integral curve is constant, so it must be zero. Equivalently the coordinate-ring pole argument first makes it constant, then the vanishing condition excludes nonzero constants.