Let $P(N,M,n)$ be the number of partitions of $n$ such that each term is $\le N$ and there are at most $M$ terms. So we know the generating function for $P(N,M,n)$ is $ \frac{(q)\_{N+M}}{(q)\_M (q)\_{N}}$. Let $P\_{sq}(n)$ be the partitions of $n$ such that all terms are perfect squares. The generating function for this would be $\prod \limits\_{k \ge 1} 1/(1-q^{k^2})$. One can easily obtain a generating function for $P\_{sq} (N^{2},n)$ where each term of the partition is $\le N^2$ by restricting $k$ from $1$ to $N$ in the generating function above.


So my question is that can we find a generating function for $P\_{sq} (N^2,M,n)$? If yes, please tell me how. 



Restricted partitions with square terms only
It can be shown that $\frac{(q)\_{N+M}}{(q)\_N(q)\_M}$ is the coefficient of $z^M$ in
$$\prod\_{k=0}^N (1-q^kz)^{-1}.$$
In other words,
$$P(N,M,n) = [q^n z^M]\ \prod\_{k=0}^N (1-q^kz)^{-1}.$$
Here $z$ in each term $(1-q^kz)^{-1} = 1+q^kz + q^{2k}z^2 + \dots$ accounts for how many parts equal $k$ are present in the restricted partition. This includes the case of $k=0$, which accounts for parts equal 0 to allow us have less than $M$ nonzero parts (if $k=0$ is excluded from the product, the coefficient of $q^nz^M$ would give the number of restricted partitions with exactly $M$ nonzero parts).


By similar arguments, the number of restricted partitions into squares is
$$P\_{sq}(N^2,M,n) = [q^n z^M]\ \prod\_{k=0}^N (1-q^{k^2}z)^{-1}.$$
However, I doubt that there exists a simple expression for the generating function $$[z^M]\ \prod\_{k=0}^N (1-q^{k^2}z)^{-1}.$$


