Find the Pattern in 3+6+12+20+30 +n

  • Thread starter Thread starter ChiralWaltz
  • Start date Start date
ChiralWaltz
Messages
161
Reaction score
5

Homework Statement


Write a loop in C for to sum the following sequence 3+6+12+20+30+...nth.

Homework Equations


n/a

The Attempt at a Solution


I have tried to factor but there are no common factors between 3 and 20 other than 1.

2*5=10------->10+20=30
2*4=8--------->8+12=20
2*3=6--------->6+6=12
2*2=4--------->4+3=7:(

I'm stuck. Any ideas?
 
on Phys.org
Recheck the first term. Hopefully it's 2.

Otherwise OEIS is kind-of your friend - you'll maybe get an answer, but it probably won't be an answer you'll like. https://oeis.org/A066140 is not a sequence you can easily generate.

The other (programming) option is to bounce the problem of the nth term into a function - which you leave unspecified.
 
  • Like
Likes   Reactions: PeroK
Thanks for the link. I have no idea what the reply was telling me.

I'm pretty sure the 3 should be a 2 also.
 
What if someone utters "hey this looks like ##\displaystyle 1+\sum_1^N n(n+1)\ ## "?
 
If someone were to utter that, I would enthusiastically test values.

N=4

1+1(1+1) = 3
1+2(2+1) = 7 o_O
1+3(3+1) = 13 :(
1+4(4+1) = 21 :L

Then I would be disappointed and confused as to if I was doing the problem right.
 
Don't understand. I see 3+6+12+20+30+...nth.
I notice 3 = 1+ 1*2, 6 = 2*3, 12 = 3*4, 20 = 4*5, 30 = 5*6
So methinks $$ 3+6+12+20+30 =
\displaystyle 1+\sum_1^N n(n+1)\ $$

(not ##\sum_1^N 1 + n(n+1)\ ## as in post #5)
 
BvU said:
Don't understand. I see 3+6+12+20+30+...nth.
I notice 3 = 1+ 1*2, 6 = 2*3, 12 = 3*4, 20 = 4*5, 30 = 5*6
So methinks $$ 3+6+12+20+30 =
\displaystyle 1+\sum_1^N n(n+1)\ $$

(not ##\sum_1^N 1 + n(n+1)\ ## as in post #5)

This is exactly the same as saying the first term of the series should be 2. - except it isn't, so let's just add a constant to that one term. You are also trying to jump to the sum instead of trying to identify the sequence.

I thought of a kludge to get us around the "faulty" start to the sequence:

##s_n = \max(n+(n+1), n*(n+1))##
 
Last edited:
Well, sorry for the confusion. I see your problem. My pattern recognition capabilities aren't up to having 3 as a starting term, so I made it (too?) easy for mself.
 

Similar threads

Replies
11
Views
2K
  • · Replies 53 ·
2
Replies
53
Views
11K
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
10
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
3
Views
2K
Replies
3
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K