English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need a function that lets me calculate the sum of all positive intergers less than or equal to N, when N is known of course. I know there is one, but I forgot what it was.

2006-10-18 15:32:49 · 4 answers · asked by trafficer21 4 in Science & Mathematics Mathematics

4 answers

The first answer (from "hello") is correct. Here is why it works:

The average of the numbers from 1 to N is equal to the sum of the largest and smallest numbers, divided by 2: (N + 1) / 2

There are N numbers being added.

The sum is equal to the number of values times the average value: N (N + 1) / 2

2006-10-18 15:47:35 · answer #1 · answered by actuator 5 · 0 0

The function is f(x) = [capital sigma](i=1 to n) i . It's difficult to write math here.

If you want to evaluate this expression, one way is to note that in (1+n)+ (2+(n-1)) + (3+(n-2))+ ... + ((n-1)+2 + (n+1), each number from 1 to n appears exactly twice. The sum is equal to (n+1) + (n+1) + ... + (n+1) n times, since there is a 1-1 correspondence between {1, ..., n} and the first summand in each (). So the sum is n(n+1), so the sum of the numbers from 1 to n is n(n+1)/2.

2006-10-18 22:45:42 · answer #2 · answered by alnitaka 4 · 0 0

N(N+1) / 2

2006-10-18 22:35:17 · answer #3 · answered by hello 2 · 0 0

Sn=(1/2)n[2a+(n-1)d]

2006-10-18 22:38:00 · answer #4 · answered by raj 7 · 0 0

fedest.com, questions and answers