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

  • Thread starter Thread starter ChiralWaltz
  • Start date Start date
AI Thread Summary
The discussion revolves around finding a pattern in the sequence 3, 6, 12, 20, 30, and deriving a loop in C to sum it. Participants express confusion over the sequence's starting term and its generation, with suggestions to explore the relationship between terms, such as noticing that each term can be expressed as products of consecutive integers. There is mention of using the OEIS for reference, but it is acknowledged that the sequence may not easily yield a formula. The conversation highlights the difficulty in identifying the correct nth term and the need to adjust the starting term for accurate summation. Overall, the participants are seeking clarity on the sequence's structure and how to implement it programmatically.
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?
 
Physics news 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 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.
 
Back
Top