Maths WorkshopMaths problems with full solutions
Exercise 623Number theory › Divisibility and gcdM1Added 4 Nov 2026

gcd(n! + 1, (n + 1)! + 1) = 1

#gcd#divisibility#factorials

Statement

Prove that for every positive integer nn, n!+1n!+1 and (n+1)!+1(n+1)!+1 are coprime.

Hint

Let dd divide both. Express (n+1)!+1(n+1)!+1 in terms of n!n! and reduce modulo dd.

Show solutionHide solution

Solution

Proof. Let dd be a common divisor. Then n!≡−1(modd)n!\equiv-1\pmod d. Since (n+1)!=(n+1) n!(n+1)!=(n+1)\,n!,
0≡(n+1)!+1≡−(n+1)+1=−n(modd),0\equiv(n+1)!+1\equiv-(n+1)+1=-n\pmod d,
so d∣nd\mid n. But n∣n!n\mid n!, hence d∣n!d\mid n!. Together with d∣n!+1d\mid n!+1 this gives d∣1d\mid1.

Check. n=3n=3: gcd⁡(7,25)=1\gcd(7,25)=1; n=4n=4: gcd⁡(25,121)=1\gcd(25,121)=1 ✓.

Remark. Equivalently, gcd⁡(n!+1,(n+1)!+1)=gcd⁡(n!+1,n)=1\gcd(n!+1,(n+1)!+1)=\gcd(n!+1,n)=1 by the Euclidean algorithm.

Lesson. To prove coprimality, assume a common divisor dd, reduce one expression modulo dd using the other, and show that dd divides 11.