It's easier to see this way:
Input 1, Output 2
Input 2, Output 5
Input 3, Output 9
Input 4, Output 14
Input 5, Output 20
Input 6, Output 27
What is the rule for this function?
INPUT OUTPUT
1 2
2 5
3 9
4 14
5 20
6 27
4 answers
If you add the first n integers, you have
1,3,6,10,15,21
We have this same sequence, starting at the 2nd term, less 1.
So, since 1+2+3+...+n = n(n+1)/2, we have
(n+1)(n+2)/2 - 1
1,3,6,10,15,21
We have this same sequence, starting at the 2nd term, less 1.
So, since 1+2+3+...+n = n(n+1)/2, we have
(n+1)(n+2)/2 - 1
Steve, you are AWESOME! Thank you so much.
Please explain:
"If you add the first n integers, you have
1,3,6,10,15,21
We have this same sequence, starting at the 2nd term, less 1."
Please explain:
"If you add the first n integers, you have
1,3,6,10,15,21
We have this same sequence, starting at the 2nd term, less 1."
The sum of the first n integers is one of the basic formulas that you learn when studying mathematical induction. If you haven't seen it, I'm not surprised you are confused.
If Tn is the nth term of the sequence,
Tn = n, and 1+2+3+...+n = n(n+1)/2
We have
Tn = n+1, so
2+3+4+...+n+(n+1) = (1+1)+(2+1)+(3+1)+...+(n+1)
= (1+2+3+...+n) + (1+1+1..) <n times>
= n(n+1)/2 + n
= (n^2+n+2n)/2 = (n^2+3n)/2
= (n^2+3n+2)/2 - 2/2
= (n+1)(n+2)/2 - 1
Actually, I kinda like n(n+3)/2 better, but (n+1)(n+2)-1 shows it's the sum of the first n+1 integers, less the first term (1).
If you had to do this from scratch, it's worth noting that
1+1+1+1... = n adding a constant n times is just a multiple of n
1+3+5+7+... = 1,4,9,16,... = n^2
adding a steadily increasing sequence gives a quadratic
So, in this problem, we'd have guessed a general quadratic an^2+bn+c, and plugging in n=1,2,3 we'd have had
#1. a+b+c = 2
#2. 4a+2b+c = 5
#3. 9a+3b+c = 9
subtracting #1 from #2 and #3 gives
#1' 3a+b=3
#2' 8a+2b=7
or,
6a+2b=6
8a+2b=7
so,
2a=1
a = 1/2
working backwards, we get
b = 3/2
c = 0
so, we have 1/2 n^2 + 3/2 n = n(n+3)/2
If Tn is the nth term of the sequence,
Tn = n, and 1+2+3+...+n = n(n+1)/2
We have
Tn = n+1, so
2+3+4+...+n+(n+1) = (1+1)+(2+1)+(3+1)+...+(n+1)
= (1+2+3+...+n) + (1+1+1..) <n times>
= n(n+1)/2 + n
= (n^2+n+2n)/2 = (n^2+3n)/2
= (n^2+3n+2)/2 - 2/2
= (n+1)(n+2)/2 - 1
Actually, I kinda like n(n+3)/2 better, but (n+1)(n+2)-1 shows it's the sum of the first n+1 integers, less the first term (1).
If you had to do this from scratch, it's worth noting that
1+1+1+1... = n adding a constant n times is just a multiple of n
1+3+5+7+... = 1,4,9,16,... = n^2
adding a steadily increasing sequence gives a quadratic
So, in this problem, we'd have guessed a general quadratic an^2+bn+c, and plugging in n=1,2,3 we'd have had
#1. a+b+c = 2
#2. 4a+2b+c = 5
#3. 9a+3b+c = 9
subtracting #1 from #2 and #3 gives
#1' 3a+b=3
#2' 8a+2b=7
or,
6a+2b=6
8a+2b=7
so,
2a=1
a = 1/2
working backwards, we get
b = 3/2
c = 0
so, we have 1/2 n^2 + 3/2 n = n(n+3)/2