Maths WorkshopMaths problems with full solutions
Exercise 1970Algebra › Equations and radicalsOlympiadAdded 5 Nov 2026

gcd(F_m, F_n) = F_gcd(m,n)

#Fibonacci numbers#gcd#Euclidean algorithm#identities

Statement

With F0=0F_0=0, F1=1F_1=1, Fn+1=Fn+Fn−1F_{n+1}=F_n+F_{n-1}, prove that for all positive integers m,nm,n,
gcd⁡(Fm,Fn)=Fgcd⁡(m,n).\gcd(F_m,F_n)=F_{\gcd(m,n)}.
Deduce that if FnF_n is prime and n>4n>4, then nn is prime.

Hint

First prove Fa+b=Fa+1Fb+FaFb−1F_{a+b}=F_{a+1}F_b+F_aF_{b-1} and gcd⁡(Fn,Fn+1)=1\gcd(F_n,F_{n+1})=1. Then show gcd⁡(Fa+b,Fb)=gcd⁡(Fa,Fb)\gcd(F_{a+b},F_b)=\gcd(F_a,F_b) and imitate the Euclidean algorithm on the indices.

Show solutionHide solution

Solution

Step 1: addition formula. For b≥1b\ge1: Fa+b=Fa+1Fb+FaFb−1F_{a+b}=F_{a+1}F_b+F_aF_{b-1}. Proven by induction on bb (both sides satisfy the Fibonacci recurrence in bb).

Step 2: consecutive terms are coprime. gcd⁡(Fn+1,Fn)=gcd⁡(Fn+Fn−1,Fn)=gcd⁡(Fn−1,Fn)=⋯=gcd⁡(F1,F0)=1\gcd(F_{n+1},F_n)=\gcd(F_n+F_{n-1},F_n)=\gcd(F_{n-1},F_n)=\dots=\gcd(F_1,F_0)=1.

Step 3: the key reduction. By Step 1, Fa+b=Fa+1Fb+FaFb−1F_{a+b}=F_{a+1}F_b+F_aF_{b-1}, so
gcd⁡(Fa+b,Fb)=gcd⁡(FaFb−1,Fb)=gcd⁡(Fa,Fb),\gcd(F_{a+b},F_b)=\gcd(F_aF_{b-1},F_b)=\gcd(F_a,F_b),
where the last equality holds because Fb−1F_{b-1} and FbF_b are coprime (Step 2).

Step 4: Euclid on the indices. By Step 3, gcd⁡(Fm,Fn)=gcd⁡(Fm−n,Fn)\gcd(F_m,F_n)=\gcd(F_{m-n},F_n) for m>nm>n. This is the subtraction form of the Euclidean algorithm, applied to the indices, which ends at gcd⁡(Fg,F0)=Fg\gcd(F_g,F_0)=F_g with g=gcd⁡(m,n)g=\gcd(m,n). Hence gcd⁡(Fm,Fn)=Fgcd⁡(m,n)\gcd(F_m,F_n)=F_{\gcd(m,n)}. ■\blacksquare

Consequence. Let n>4n>4 be composite, n=abn=ab with 2≤a≤b2\le a\le b. Since n≠4n\ne4, b≥3b\ge3, and b<nb<n. By the formula, gcd⁡(Fb,Fn)=Fgcd⁡(b,n)=Fb\gcd(F_b,F_n)=F_{\gcd(b,n)}=F_b, i.e. Fb∣FnF_b\mid F_n. Here Fb≥F3=2F_b\ge F_3=2 and Fb<FnF_b<F_n, so FnF_n has a proper divisor Fb>1F_b>1 and is composite. Hence if FnF_n is prime and n>4n>4, then nn is prime.

Remark. The converse fails: F19=4181=37⋅113F_{19}=4181=37\cdot113.

Lesson. A divisibility property that is "Euclid-like" (gcd of values equals value at the gcd) is proved by showing gcd⁡(f(a+b),f(b))=gcd⁡(f(a),f(b))\gcd(f(a+b),f(b))=\gcd(f(a),f(b)).