Let $Q(n)$ give the number of ways of writing the integer $n$ as a sum of positive integers without regard to order with the constraint that all integers in a given partition are distinct. Equation $(11)$ on [this page](http://mathworld.wolfram.com/PartitionFunctionQ.html) mentions (without proof) a recurrence relation for $Q(n)$, 


$$Q(n) = s(n) + 2\sum\_{k=1}^\sqrt{n}(-1)^{k+1}Q(n-k^2)$$


where 


$$s(n) = \begin{cases}
 (-1)^j,& \text{if } n= j(3j \pm 1)/2\\
 0, & \text{otherwise}
\end{cases}$$


I also came across this identity (again no proof) in [Abramowitz and Stegun's book](http://people.math.sfu.ca/~cbm/aands/abramowitz_and_stegun.pdf) on mathematical formulas (pg. 826). What is the proof of this fact?



Recurrence relation for the number of partitions of an integer  with distinct summands
Gauss showed that
 $$ \prod\_{n\geq 1}\frac{1-q^n}{1+q^n} = 1+2\sum\_{n\geq 1}(-1)^n q^{n^2}. $$
We also have $\sum\_{n\geq 0} Q(n)q^n = (1+q)(1+q^2)\cdots$ and $\sum\_{n\geq 0} s(n)q^n = (1-q)(1-q^2)\cdots$ (Euler's pentagonal number formula). The recurrence follows from equating coefficients of $q^n$ on both sides of 
 $$ \prod\_{n\geq 1}(1-q^n) = \left(1+2\sum\_{n\geq 1}(-1)^n q^{n^2}\right)\prod\_{n\geq 1}(1+q^n). $$


