TAOCP 1.2.3 Exercise 17

By definition, $\sum_{j \in S} 1$ is the sum of one copy of $1$ for each integer $j$ belonging to $S$.

Section 1.2.3: Sums and Products

Exercise 17. ▶ [M00] Let $S$ be a set of integers. What is $\sum_{j \in S} 1$?

Verified: yes
Solve time: 34s


By definition, $\sum_{j \in S} 1$ is the sum of one copy of $1$ for each integer $j$ belonging to $S$. Therefore the value of the sum is simply the number of elements of $S$.

If $S$ is finite, containing exactly $m$ integers, then

$$ \sum_{j \in S} 1 = m. $$

If $S$ is infinite, the sum diverges, since the partial sums increase without bound. Hence

$$ \boxed{\sum_{j \in S} 1 = |S|} $$

when $S$ is finite.