Closed form for Fibonacci numbers

272 Views Asked by At

We know the closed form for Fibonacci number as $F_n=\frac{1}{\sqrt5}\left[\left(1+\frac{\sqrt5}{2}\right)^n−\left(1−\frac{\sqrt5}{2}\right)^n\right]$

But while finding $F_n \pmod{99991}$ the closed form changes to

$$F_n= \frac{a^n -b^n}{a-b} \pmod{99991} $$ where $a=55048$, $b=44944$.

How exactly we obtain the $a$ and $b$ values for some $m$?

1

There are 1 best solutions below

5
On

The characteristic polynomial for the Fibonacci recursion is $x^2-x-1$. If we are over some field $F$ with characteristic $\ne2$, we need to determine an extension field $K$ such that the polynomial splits. If $a$ and $b$ are roots, then the Fibonacci sequence can be written $$ f_n=ua^n+vb^n $$ and from $f_0=0$, $f_1=1$ we get $v=-u$, $u=1/(a-b)$. So the general form is $$ f_n=\frac{a^n-b^n}{a-b} $$ The roots are distinct whenever the characteristic of the field is $\ne5$.

In the case when $F$ is $\mathbb{Z}/99991\mathbb{Z}$ we find that the roots are in the field, so no extension is necessary, and they are $44944$ and $55048$. So $$ f_n=22019(55048^n-44944^n)\bmod 99991 $$ because $22019$ is the inverse of $55048-44944$ modulo $99991$.

(Note: I used Pari-GP to make the computation, it's just very tedious to compute the roots by hand.)