0

Consider the Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, ... What are the last three digits (from left to right) of the 2020th term?

I tried using formulae for nth term of Fibonacci series using generating function and then apply binomial expansion to eliminate irrational terms and then apply mod 1000. I couldn’t make much headway. Is there a smarter way to solve this problem given we have 7 to 8 minutes to solve in contest settings.

Mathronza
  • 164
  • 3
    Please post a link to this contest. Is it ongoing? – lulu Jan 14 '21 at 11:48
  • calculators are allowed? even though using the formula for the nth fibonacci term is not feasible. as the last 3 digits are asked, there must be a smarter way. we would perhaps need to bring mod(1000) to get the last 3 terms – Aatmaj Jan 14 '21 at 11:54
  • 2
    I would start by considering the sequence in $\mod 1000$. – Matti P. Jan 14 '21 at 11:54
  • The contest has concluded on June 2020. No calculators are allowed. – Mathronza Jan 14 '21 at 12:10
  • 2
    Pleaser post a link to the contest. I don't see how to do it with pencil and paper. It's easy to get the answer $\pmod 8$ but $\pmod {125}$ takes a little effort. Not much, really, but a calculator sure helps. – lulu Jan 14 '21 at 12:12
  • In mod 1000, apparently the period is 1500 : http://oeis.org/A096363 – Matti P. Jan 14 '21 at 12:13
  • 1
    @MattiP In general, the last $d$ digits are periodic with period $15\times 10^{d-1}$, at least for $d≥3$. See, e.g., this. But this is hardly a well known (or obvious) result. In this case, all you need is the period $\pmod {125}$ but as that is $500$, pencil and paper seems unlikely to succeed. – lulu Jan 14 '21 at 12:19
  • ...the period is $20$ $\pmod 5$ and that is an easy, pencil and paper, computation. Maybe there's a quick way to deduce that $500$ works $\pmod {125}$ from that, but I am not seeing it. – lulu Jan 14 '21 at 12:21
  • I would really appreciate a solution, if possible – Mathronza Jan 14 '21 at 12:26
  • FWIW, here's a fast Fibonacci calculator, written in Python, that can handle modulus. – PM 2Ring Jan 14 '21 at 13:55
  • I wonder if this answer helps. I have got time to look at the theorem it quoted from a paper. – Neat Math Jan 14 '21 at 14:50

1 Answers1

3

By the CRT it’s enough to figure out $F_{2020}$ mod $8$ and $125$.

It’s easy to check that six applications of the linear recurrence relation turn $(0,1)=(F_0,F_1)$ into $(F_6,F_7)=(8,13)=5 \cdot (0,1)$ mod $8$. As the multiplicative order of $5$ mod $8$ is two, it follows that $F_n$ mod $8$ has a period of $12$. Now note that $2020$ is congruent to $4$ mod $12$ so $F_{2020}$ is congruent to $3$ mod $8$.

Now mod $125$. That one is trickier and I’ll need some matrix formalism. Note that five times the recurrence relation turn $(0,1)$ into $(5,8)=5 \cdot (1,1)+3 \cdot (0,1)$ and turn $(1,1)$ into $(F_6,F_7)=(8,13)=8 \cdot (1,1)+5 \cdot (0,1)$, so mod $5$, five times the recurrence relation means multiplication by three.

In other words, let $A=\begin{bmatrix}1 & 1\\1& 0\end{bmatrix}$ be the matrix representing the recurrence relation for the pair $(F_{n+1},F_n)$, then $A^5$ mod $5$ is three times the identity, ie $A^5=3I+5B_1$ for some integer matrix $B$. Thus $A^{20}=I+5B$ for some integer matrix $B$.

Now, mod $125=5^3$, $A^{20n}=I+5nB+25\frac{n(n-1)}{2}B^2$, so to get the identity matrix on the right-hand side we can choose $n=25$. It follows that $F_n$ mod $125$ is $500$-periodic and $F_{2020}$ mod $125$ is $F_{20}$ mod $25$.

Now, we can check (without a calculator) that (all mod $125$) $F_{12}=19,F_{13}=-17$, so $F_{14}=2,F_{15}=-15,F_{16}=-13,F_{17}=-28,F_{18}=-41,F_{19}=-69,F_{20}=15$.

Finally, it follows that $F_{2020}=515$ mod $1000$ (I hope).

Aphelli
  • 37,929