1
$\begingroup$

The Triangular numbers are known to be $1, 3, 6, 10, 15, 21 ...$ In general, the $n$th triangular number is $$\frac{n(n + 1)}{2}.$$ Is there a way to get the general closed form solution from a given seed value ?

For example, in the above numbers, the pattern is easy to see as $+2, +3, +4, +5, +6,\dotsc$ and so on.

What if I have some arbitrary starting value $A$ and a seed value such as $B$ so I can generate the following sequence $A, A + B, (A + B) + (B + 1)...$

What would be the closed form solution to this sequence similar to something like the one for triangular numbers?

$\endgroup$
4
  • $\begingroup$ Search for "arithmetic progression" $\endgroup$
    – Chappers
    Oct 19 '17 at 20:29
  • 1
    $\begingroup$ @Chappers In an arithmetic progression the difference between any two given terms in constant. That is not the case here. $\endgroup$ Oct 19 '17 at 20:31
  • $\begingroup$ Whoops, good point. So what you have is actually the sum of the first $n$ terms of an arithmetic progression. $\endgroup$
    – Chappers
    Oct 19 '17 at 20:34
  • $\begingroup$ You can use the same proof as for the triangular number formula: write them out in both original and reverse order, add the corresponding terms, and divide by 2. $\endgroup$
    – Chappers
    Oct 19 '17 at 20:36
1
$\begingroup$

You can take out A to see the sequence more clearly:

$0,B,B+B+1,B+B+1+B+2,...$

So, at the $n-th$ step (starting from $0$-th step) we have the term $nB+(1+2+...+(n-1))$

Hence, overall the $n-th$ term is $A+ nB+(1+2+...+(n-1))$, which I'm sure you can simplify it further.

$\endgroup$
1
$\begingroup$

We can use the sum function of a general quadratic sequence:

$$S_2(n,s,d_1,c) = \cfrac{n(cn^2 + 2c + 3nd_1 + 6s - 3cn - 3d_1)}{6}$$

Where $n$ is the number of terms to be summed, $s$ is the starting term of the series, $d_1$ is the first difference (subtracting the first term from the second term) and $c$ is the constant difference between the differences.

So e.g. for $1, 3, 6, 10, 15, 21, \ ...$ you would get the $n$th number by taking the sum up to $n$ terms, then subtracting the sum up to $n-1$ terms.

For your example we can see that $s = 1, d_1 = 2, c=1$, plug in the values into the function:

$$S_2(n,1,2,1) - S_2(n-1,1,2,1) = \frac{n(n+1)}{2}$$

Here you can use any starting value, any difference and so on.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.