1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Nov 13, 2014 #1
    1. The problem statement, all variables and given/known data
    Write a loop in C for to sum the following sequence 3+6+12+20+30+...nth.

    2. Relevant equations

    3. The attempt at a solution
    I have tried to factor but there are no common factors between 3 and 20 other than 1.


    I'm stuck. Any ideas?
  2. jcsd
  3. Nov 13, 2014 #2
    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.
  4. Nov 13, 2014 #3
    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.
  5. Nov 14, 2014 #4


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    What if someone utters "hey this looks like ##\displaystyle 1+\sum_1^N n(n+1)\ ## "?
  6. Nov 14, 2014 #5
    If someone were to utter that, I would enthusiastically test values.


    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.
  7. Nov 14, 2014 #6


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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)
  8. Nov 14, 2014 #7
    This is exactly the same as saying the first term of the series should be 2. - except it isn't, so lets 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: Nov 14, 2014
  9. Nov 14, 2014 #8


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted