If you know the the first two terms, you know the initial term and the common difference. This Wikipedia article then gives you the formula for the sum of n terms, so you have to solve the equation for n.
The formula for a sum of a finite arithmetic series is:
In this formula, is the first term. n is the number of terms. d is the common difference (the rate at which the series progresses).
We know that the first term is 21, and we know that the common difference is -3, and that the sum of this series is -24.
Therefore, we have:
now we solve for n:
divide by three to get:
Since we cant have a negative number of terms, -1 is not a valid answer. Thus, we have :