TITLE: Adjust the Fibonacci function for different initial conditions
QUESTION [5 upvotes]: Someone on stackoverflow asked a question about tracking score in their game with a Fibonacci like sequence, just starting at different values $(F_1 = 50,~ F_2 = 100)$.  I know there's a formula to calculate Fibonacci numbers (based on Wikipedia) but I'm not familiar with most of the math that formula is based on.
Is there a way to adjust the formula to be used with these new initial conditions?

REPLY [2 votes]: The recursion relation $F(n+2) = F(n+1)+F(n)$ suggests the generating function $x^2f(x) = xf(x)+f(x) \rightarrow f(x) = \frac 1 {x^2-x-1} = 1/[(x-\phi)(x+\phi^{-1})]$, where $\phi = \frac {1+\sqrt 5}2$. This fraction can be decomposed by partial fractions into $\frac A {x-\phi}+\frac B {x+\phi^{-1}}$. This is then two geometric sequences $A(\sum (\phi x)^n+B(\sum (-\phi^{_1})^n)$ or  $\sum (A\phi^n+B(-\phi^{-1})^n)x^n$.
I've left $A$ and $B$ as variables rather than solving for them, as the above doesn't take into account the initial terms, and the values of $A$ and be $B$ will depend on those terms; when we plug those in, we have two unknowns ($A$ and $B$), and two constraints (the two initial terms). In fact, given any $a_{i},a_{j}$, we can solve for $A$ and $B$ with $A\phi^{i}+B(-\phi^{-1})^{i}=a_{i}$ and $A\phi^{j}+B(-\phi^{-1})^{j}=a_{j}$. 
In the particular case you gave, we have that the standard Fibonacci sequence goes $0,1,1,2,3,5,8...$ (although conventions vary whether it starts with $0$ or $1$). Multiply these numbers by $50$ yields $0,50,50,100,150,250,400...$. Your numbers $50,100$ correspond to $a_2,a_3$ of that sequence (with zero indexing), and so if $b_n$ denotes the $n$-th number in your sequence (with $b_1 = 50$, $b_2=100$), and $F_n$ denotes the $n$-th number of the Fibonacci sequence ($F_0=0$, $F_1=1$, $F_2=1$, ...), then $b_n = 50F_{n+1}$.