The class performs a recursive computation

For our example, a class of 25 students will compute the sum of the numbers from 1 to 25.

The smart aleck, in the back corner of the class, initiates the computation.

He knows that the sum from 1 to 25 is really just 25 + the sum from 1 to 24. He asks his friend to figure out the sum of the values from 1 to 24 for him.

His friend realizes he can use the same strategy to compute the numbers from 1 to 24, and asks the person next to him to compute the values from 1 to 23, all students of the class do the same thing.

The final student acts as the 'base case'.

Once the question makes it through the whole class, the final student is asked, simply, "What is the sum from 1 to 1?"

They answer, "That's just 1."

Now, the 2nd last student computes 1+2. The 3rd last student takes their result and adds 3 to it to get the sum of the numbers from 1 to 3. They pass that on to the next student.

Eventually, the sum gets to the back of the class and the smart aleck has the result.

What's the sum from 1 to 24?