TITLE: Proof that the number of 1's in $P(n)$ equals the number of distinct magnitudes in $P(n)$
QUESTION [7 upvotes]: For given division of number $n$ (let name that $\pi$) we are going to consider: 
$A(\pi)$ it is a number of $1$ in $\pi$ 
$B(\pi)$ it is a number of different elements in $\pi$. 
Proof that $$ \sum_{\pi} A(\pi)  = \sum_{\pi} B(\pi) $$
Example:
$$ \pi = 1 + 1 + 2 + 2 +2 + 4 $$
then $$A(\pi) = 2 \wedge B(\pi)=3$$
Hint: Consider each side of equation in use of 
$P(1), P(2), ... P(n-1)$ where $P(k)$ is number of divisions of $k$.
My try
I have no idea how to use that hint, so I decided to define $\delta = A(\pi)  - B(\pi) $ and hope that it can help me to find bijection.
Example for $n=5$
\begin{array}{|c|c|c|c|}
\hline
\pi& \delta\\ \hline
5 & -1  \\ \hline
4+1 & -1  \\ \hline
3+2 &   -2 \\ \hline
3+1+1 & 0  \\ \hline
2+2+1 &  -1 \\ \hline
2+1+1+1 &  1 \\ \hline
1+1+1+1+1 & 4  \\ \hline
\end{array}
but it doesn't help me so probably hint is really important.

REPLY [3 votes]: This could be solved by considering generating functions. Call the first sum $\mathcal A_n$ and the second sum $\mathcal B_n$. 
Thus first we have:
$$\begin{align*}
\sum_{n\in\mathbb{N}} \mathcal A_nx^n&= \underbrace{\left(\sum_{k\ge0}kx^k\right)}_{\text{Counting # of 1's}}\underbrace{\left(\prod_{r\ge2}\frac1{1-x^r}\right)}_{\text{The rest}}\\ 
 &= \frac x {\left ( 1-x \right )^2}\,\left(\prod_{r\ge2}\frac1{1-x^r}\right)\\
&=\frac x {1-x}\,\left(\prod_{r\ge1}\frac1{1-x^r}\right)
\end{align*}$$
Then:
$$\begin{align*}
\sum_{n\in\mathbb{N}} \mathcal B_nx^n&= 
\frac{\partial }{\partial k}\left.\left ( \prod_{r\ge1}\left ( 1+kx^r+kx^{2r}+kx^{3r}+\cdots \right ) \right )\right|_{k=1}\\
&= 
\frac{\partial }{\partial k}\left.\left ( \prod_{r\ge1}\left ( \frac k {1-x^r}-k+1 \right ) \right )\right|_{k=1}\\
&=\left.\left ( \prod_{r\ge1} \frac k {1-x^r}-k+1  \right )\underbrace{\left ( \sum_{r\ge1} \frac{\frac 1 {1-x^r}-1}{\frac k {1-x^r}-k+1}  \right )}_{\text{Product rule term}}\right|_{k=1}\\
&=\left ( \prod_{r\ge1} \frac 1 {1-x^r}  \right )\left ( \sum_{r\ge1} x^r  \right )\\
&=\frac x {1-x}\,\left(\prod_{r\ge1}\frac1{1-x^r}\right)
\end{align*}$$
Therefore $\mathcal A_n=\mathcal B_n$ as desired. 

As a side note, this also suggests that both are equal to $\sum_{h=0}^{n-1}P(h)$, so maybe there is a more elementary approach. 
Update: 
Turns out there is! For the following I'll write $\mathcal P_n=\sum_{h=0}^{n-1}P(h)$. 

$\text{1. }\mathcal A_n=\mathcal P_n\text{:}$

For every partition of $n$ containing $k$ many $1$'s, we map it to $k$ other partitions as follows, for example:
$$\color{red}{1+1+1}+3+4~\longrightarrow~\begin{cases}
\color{blue}{1+1}+3+4 \\ 
\color{blue}{1}+3+4 \\ 
3+4 
\end{cases}$$
Thus the reverse mapping is by appending "$+1$"s to any partition of some $0\le h\le n-1$ until the whole sums evaluates to $n$. 
Therefore the sum of all appearance of $1$'s is equal to the count of all partitions of any $0\le h\le n-1$, which shows that $\mathcal A_n=\mathcal P_n$ as desired. 

$\text{2. }\mathcal B_n=\mathcal P_n\text{:}$

We can obviously transform $\mathcal B_n$ to the sum $\sum_{k=1}^{n}P\left(n\mid\exists k\right)$ where $P\left(n\mid\exists k\right)$ counts the number of partitions of $n$ using at least one $k$. 
Note however that $P\left(n\mid\exists k\right)$ is just $P\left(n-k\right)$, thus 
$$\mathcal B_n=\sum_{k=1}^{n}P\left(n-k\right)=\sum_{h=0}^{n-1}P(h)=\mathcal P_n$$
as desired.