What is the sum of the first 100 consecutive integers starting with 1? It is possible to work this problem quickly without having to do repetitive sums. A very simple formula exists that will compute the sum of consecutive integers from 1 to n for any value of n. Can you discover the formula by simple reasoning and a little arithmetic

What will be an ideal response?

Input: Consecutive integers from 1 to 100
Consecutive integers from 1 to n
Output: Sum of 100 integers
Sum of n integers
Process:
Notation: Let number of integers = n
Diagram: None needed.
Approach: Work the general problem first.
Then use formula to find case when n = 100
There are several ways to approach the general solution to this problem. The approach below uses the hint and makes use of the definition for the arithmetic mean given in section A-6.
Average = sum of n numbers / count of n numbers Sum of n numbers .= average * count of n numbers Count of n numbers = n
Sum of n numbers — average * n (Equation 1)
We now have a new problem: Find the average of the first n integers
starting with one.
The average for all numbers in the sum can be found by noting that opposite pairs of numbers all have the same average:
Last (n) and first (1) number is: =(n+ 1)/2
Second from last (n — 1) and second number (2): —(n-1+2)/2 =(n+ 1)/2
Third from last (n — 2) and third number (3):
=(n-2 +3)/2 -=(n+1)/ 2
All these opposite pairs have the same average: = (n + 1) I 2

Computer Science & Information Technology

You might also like to view...

The ________ displays the time that has elapsed since the video started while the video is playing

A) title bar B) control panel C) status bar D) slide pane

Computer Science & Information Technology

Although a method can throw any number of ____ types, many developers believe that it is poor style for a method to throw and catch more than three or four types.

A. Error B. Clause C. Exception D. Catch

Computer Science & Information Technology