Maths WorkshopMaths problems with full solutions
Exercise 1279Number theory › PrimesOlympiadAdded 4 Nov 2026

n divides 2ⁿ − 1 only for n = 1

#order#Fermat's little theorem#smallest prime divisor

Statement

Find all positive integers nn such that nn divides 2n−12^n-1.

Hint

If n>1n>1, look at the smallest prime divisor pp of nn and at the order of 22 modulo pp.

Show solutionHide solution

Solution

Answer. Only n=1n=1.

Idea. The order of 22 modulo the smallest prime factor of nn must be a divisor of nn smaller than that prime.

Proof. Let n>1n>1 with n∣2n−1n\mid2^n-1 and let pp be the smallest prime divisor of nn. Since 2n−12^n-1 is odd, pp is odd. Let dd be the order of 22 modulo pp, i.e. the least d≥1d\ge1 with 2d≡1(modp)2^d\equiv1\pmod p.

  • From 2n≡1(modp)2^n\equiv1\pmod p we get d∣nd\mid n.
  • From Fermat's little theorem 2p−1≡12^{p-1}\equiv1 we get d∣p−1d\mid p-1.

So dd divides both nn and p−1p-1. Now d≠1d\ne1 because 2≢1(modp)2\not\equiv1\pmod p. Hence d>1d>1 has a prime divisor qq with q≤d≤p−1<pq\le d\le p-1<p, and q∣d∣nq\mid d\mid n. This contradicts the minimality of pp.

Check. n=1n=1 works trivially; for instance n=3n=3 fails since 23−1=72^3-1=7.

Remark. The same argument shows that n∣2n−1n\mid2^n-1 cannot hold for n>1n>1, but n∣2n+1n\mid2^n+1 has infinitely many solutions (e.g. n=3,9,27,…n=3,9,27,\dots).

Lesson. "Take the smallest prime divisor and use orders" is the standard way to show that a divisibility n∣an−1n\mid a^n-1 is impossible.