Generating function for writing an even number as a sum of at most k squares

78 Views Asked by At

I would like to find the exact number of ways in which $n$ can be represented as a sum of at most $k$ squares such that each term is less than or equal to say, $N$. A generating function for this problem would be fine. I tried to approach the problem through restricted partitions but could not incorporate the condition - at most $k$ terms.