Maths WorkshopMaths problems with full solutions
Exercise 921Number theory › Divisibility and gcdL1Added 3 Nov 2026

A recursive GCD

#gcd#Fibonacci#recursion

Statement

Let FnF_n be the Fibonacci sequence with F0=0F_0=0, F1=1F_1=1. Show that gcd⁡(Fm,Fn)=Fgcd⁡(m,n)\gcd(F_m,F_n)=F_{\gcd(m,n)}.

Hint

Use the Euclidean algorithm and the Fibonacci recurrence.

Show solutionHide solution

Solution

Key identity. gcd⁡(Fm,Fn)=gcd⁡(Fm−n,Fn)\gcd(F_m,F_n)=\gcd(F_{m-n},F_n) for m>nm>n (from Fm=Fm−nFn+1+Fm−n−1FnF_m=F_{m-n}F_{n+1}+F_{m-n-1}F_n).

Iteration. This mirrors the Euclidean algorithm on (m,n)(m,n), so the final gcd is FdF_d where d=gcd⁡(m,n)d=\gcd(m,n).

Conclusion. gcd⁡(Fm,Fn)=Fgcd⁡(m,n)\gcd(F_m,F_n)=F_{\gcd(m,n)}.

Example. gcd⁡(F6,F4)=gcd⁡(8,3)=1=Fgcd⁡(6,4)=F2=1\gcd(F_6,F_4)=\gcd(8,3)=1=F_{\gcd(6,4)}=F_2=1.