Given two numbers, say x and y, and a recusively defined additive sequence such that each new term is the sum of the previous two terms, with x and y being the first two terms, and going until the 10th term as in the following...

3 5 8 13 21 34 55 89 144 233
2 7 9 16 25 41 66 107 173 280
3 4 7 11 18 29 47 76 123 199
4 5 9 14 23 37 60 97 157 254
3 8 11 19 30 49 79 128 207 335

... is there an easy way to find the sum of those 10 numbers? Using just the first two terms? Easy as in taking a few seconds to calculate in your head?

My easy way to do was a simple perl script...

```#!/bin/perl -w

\$x=\$ARGV;
\$y=\$ARGV;
\$z=0;
\$sum=\$y+\$x;

print "0  \$x\n1  \$y\n";

for (\$i=2;\$i<10;\$i++) {
\$z=\$x+\$y;
\$sum=\$sum+\$z;
\$x=\$y;
\$y=\$z;
print "\$i  \$z\n";
}

print "\nTotal: \$sum\n";```

... which works great, but doesn't fulfill the "in your head in a few seconds" qualifier. :P So my question is... does anyone know of a simple equation to put towards these questions that would fulfull the requirements? I've been playing with it for about a half hour doing random trial and error attempts using the first two terms, the number of terms, the tenth term, the sum of the ten terms, and more recently the difference between the two terms, but my random math skills aren't achieving me anything. :P

Someone out there has to know a way... :P

it's 55x + 88y. (guess who actually sat down with a notebook...lol..I always loved figuring out math stuff..it works for all of those numbers you choose too.

Actually, 55x + 89y is the 12th term (from his example)

I think 21x + 34y fits, though.

First term is x, then y, then x+y, then x + 2y, then 2x + 3y... etc.

Hope this helps. :)

He's actually looking for the total of all the numbers up to the tenth term. Your formula only works for the Fibonacci-style "3 5 8 13 ..." sequence, and gives the tenth term instead of the total. weirdkarma's formula does give the total for all ten numbers, but still only works on the first number set (I tried the top two and the second one did not work...check that notebook again? ;-) ).

I haven't thought much about this, but if a simple general solution is out there, it will be based on the defining characteristic of the number sequence: except for the first two numbers, that each number is the sum of the two previous. I have a simple solution, as long as you actually have the list of numbers. Add the 9th and 10th terms, then add the result to the tenth term, then subtract "y".

I'd grab my stats book and pull out a permutation formula that could give the 9th and 10th (or n-1 and n) terms, but it's too dark and I need to work tomorrow. It does look like a simple solution is in here somewhere.

--- garrett

Hmmm...yeah, I stuck a sequence into Excel which let me change the two initial numbers at will, and compared the sum to "55x + 88y".

weirdkarma's formula does appear to work for all x's and y's positive and negative, as well as decimals. At first it didn't appear to make sense (the summing error on my part helped), but "55x + 88y" is actually related to the Fibonacci sequence, where the sequence is actually 55 89, but weirdkarma's 88 subtracts one y as in the method I talked about above. See, 55 is the tenth term in the Fibonacci sequence, and you have to subtract one y because the first two numbers don't follow the "= sum two previous" rule. You can use this the generate a general solution:

The sum of all numbers in the sequence described by Medlir, where the first two numbers are x and y, is equal to "Fib(n)*x + Fib(n+1)*y - y" or "Fib(n)*x + (Fib(n+1)-1)*y" where Fib(n) is the nth Fibbonaci number (the sequence starts with "1 1 2 3 5 8 ...") and Fib(n+1) is the next number in the Fibonacci sequence. This allows you to figure out the sum for any number of terms, besides ten.

Go to http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/fibFormulae.html for a lot of useful formulas, most not directly related to the problem.

--- garrett

On that website, the section on "Generalized Fibonacci Sequences" is exactly what Medlir described, and there are plenty of summation formulas for different cases. Though not as handy as "55x + 88y" although I'm sure one of the summations would simplify down to that, for a tenth term. 