On this page
Pierre de Fermat noticed that 3, 5, 17, 257 and 65537 are all prime and guessed the pattern never breaks. It breaks at the very next step, and Euler's way of catching it is a piece of hand arithmetic worth knowing.
What are Fermat numbers?
A Fermat number is a number of the form Fₙ = 2^(2ⁿ) + 1, where n = 0, 1, 2 and so on (Wikipedia: Fermat number). The exponent doubles at every step, so the numbers grow very fast:
F₀ = 2¹ + 1 = 3
F₁ = 2² + 1 = 5
F₂ = 2⁴ + 1 = 17
F₃ = 2⁸ + 1 = 257
F₄ = 2¹⁶ + 1 = 65537
F₅ = 2³² + 1 = 4294967297
Fermat conjectured that every Fermat number is prime (MathWorld: Fermat number). No Fermat prime beyond F₄ is known, and as of December 2025 Fₙ is known to be composite for every n from 5 to 32 (Wikipedia: Fermat number).
How did Euler show that F₅ = 641 × 6700417?
Euler wrote in 1732 that 2³² + 1 = 4294967297 is not prime because it is divisible by 641; the paper, E26 in the Euler Archive, was published in 1738 (Euler Archive: E26). The full split is F₅ = 641 × 6700417 (Wikipedia: Fermat number).
You do not have to guess divisors at random. Euler proved that every prime factor of Fₙ has the form k·2^(n+1) + 1, and Lucas sharpened this in 1878 to k·2^(n+2) + 1 for n ≥ 2 (MathWorld: Fermat number). For F₅ that means 128k + 1: none of 129, 257, 385 or 513 divides F₅, and the fifth candidate, 641, does. The other factor fits too: 6700417 = 52347 × 128 + 1.
Here is the check, step by step. The trick is that 641 can be written in two ways: 641 = 5·2⁷ + 1 and 641 = 5⁴ + 2⁴ (Wikipedia: Fermat number). Work modulo 641:
From 641 = 5·2⁷ + 1, we get 5·2⁷ ≡ −1.
Raise both sides to the fourth power: 5⁴·2²⁸ ≡ 1.
From 641 = 5⁴ + 2⁴, we get 5⁴ ≡ −2⁴.
Substitute: −2⁴·2²⁸ ≡ 1, so −2³² ≡ 1.
Therefore 2³² + 1 ≡ 0, and 641 divides F₅.
No ten-digit division anywhere.
Why are two different Fermat numbers always coprime?
The key identity is F₀·F₁·…·Fₙ₋₁ = Fₙ − 2 for n ≥ 1 (Wikipedia: Fermat number). Check n = 5: 3 × 5 × 17 × 257 × 65537 = 4294967295, which is F₅ − 2. The proof is a telescope: 2^(2ⁿ) − 1 = (2^(2ⁿ⁻¹) − 1)(2^(2ⁿ⁻¹) + 1), and repeating this down to 2¹ − 1 = 1 leaves the product of all earlier Fermat numbers.
Now suppose d divides both Fₘ and Fₙ with m < n. Then d divides the product on the left and Fₙ, so d divides their difference, 2. Every Fermat number is odd, so d = 1. Wikipedia names this Goldbach's theorem (Wikipedia: Fermat number).
This gives a second proof that there are infinitely many primes. Each Fₙ has at least one prime factor, and no prime divides two of them, so infinitely many Fermat numbers need infinitely many different primes. Compare Euclid's argument in proof by contradiction with √2 and the primes, and see Fermat's little theorem at work in Carmichael numbers and the 561 trap in Fermat's test.
What do Fermat numbers have to do with regular polygons?
Gauss proved in 1796 that the regular 17-gon can be constructed with compass and straightedge (Wikipedia: Constructible polygon). The general rule is that a regular n-gon is constructible exactly when n is a power of 2 times distinct Fermat primes; Gauss stated without proof that it was also necessary, and Pierre Wantzel gave the full proof of necessity in 1837 (Wikipedia: Constructible polygon).
So the triangle (3), pentagon (5), 15-gon (3 × 5) and 17-gon are constructible. The heptagon is not, because 7 is not a Fermat prime, and the 9-gon is not, because 9 = 3 × 3 uses the Fermat prime 3 twice. For a hands-on feel of points spaced round a circle, see how to draw a star polygon by skipping points.
How should you practise Fermat numbers?
A short plan for olympiad-style number theory practice:
Write F₀ to F₅ from memory by doubling the exponent.
On a blank page, redo the five-step 641 argument without looking.
Prove F₀·F₁·F₂·F₃ = F₄ − 2 by multiplying, then by the telescope.
Decide which regular polygons are constructible: 20, 51, 18, 85. (Yes, yes, no, yes.)
If modular arithmetic still feels shaky, the Fermi Concept Library has every mathematics concept with its own lesson. For practice, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



