Let's say that we have a number S that represents a sum. This sum can be broken down into a sum of terms. I want to calculate how many expressions I can write that represent that sum where terms are in the range from $ 1 $ to $ S $.
Example:
$$\begin{align} 4 &= 1 + 1 + 1 + 1\\ 4 &= 2 + 1 + 1\\ 4 &= 1 + 2 + 1\\ 4 &= 1 + 1 + 2\\ 4 &= 2 + 2\\ 4 &= 3 + 1\\ 4 &= 1 + 3\\ 4 &= 4 \end{align} $$ For $S=4$ we have $N=8$ .
For $S=3$, we have $N=4$
Although I figured out that I can calculate that with this formula:
$N = 2^{S-1}$
I can't really tell why is that. I can count them for few sums and see the rule but is there a better way to explain this?
See Pascal's triangle. Notice how each subsequent line is created by summing up its previous lines. For example, let's see the 4 example. See the fourth line, which says 1 3 3 1. This means there are 1 way to sum 4 with 4 integers, 3 ways to sum 4 with 3 integers, 3 ways to sum 4 with 2 integers, and 1 way to sum 4 into 1 integer. And the sum of each row of Pascal's triangle is $2^{S-1}$.