Does a sum require 2+ numbers, such as $sum(a, b, ...)$? Does $sum(n)$ imply $n + 0$?

63 Views Asked by At

This came up when someone else asked "How many sums of positive integers result in $n$"? And they gave the example:

5 can be written as:
5
4+1
3+2
3+1+1
2+2+1
2+1+1+1
1+1+1+1+1

But, this brings up an interesting question that would fundamentally change pattern recognition for their question. The first entry of their list is 5, which implies they're intending $sum(5)$ to be valid.

But... does this actually imply $sum(5,0)$?

If so, should the first item in the list be disregarded since 0 is not a positive integer?

1

There are 1 best solutions below

0
On

Given a list of elements $[a_1, a_2, \dots, a_n]$, we define the sum of this list to be $a_1 + a_2 + \dots + a_n$.

This definition is fine when $n=1$: then given a list $[a_1]$, we define its sum to be $a_1$.

When $n=0$, we conventionally take the sum of the empty list $[]$ to be $0$. This allows us to maintain the property that $$\mathrm{sum}(l_1) + \mathrm{sum}(l_2) = \mathrm{sum}(l_1 \oplus l_2)$$ where $\oplus$ is my ad-hoc notation for the concatenation operation: $$[a_1, \dots, a_n] \oplus [b_1, \dots, b_m] := [a_1, \dots, a_n, b_1, \dots, b_m]$$