Mathwords logoMathwords

Fermat Prime — Definition, Formula & Examples

A Fermat prime is a prime number that can be written in the form 22n+12^{2^n} + 1, where nn is a non-negative integer. Only five Fermat primes are known: 3, 5, 17, 257, and 65537.

A Fermat number is defined as Fn=22n+1F_n = 2^{2^n} + 1 for n{0,1,2,}n \in \{0, 1, 2, \dots\}. A Fermat prime is a Fermat number that is also prime. As of current knowledge, the only prime Fermat numbers are F0=3F_0 = 3, F1=5F_1 = 5, F2=17F_2 = 17, F3=257F_3 = 257, and F4=65537F_4 = 65537.

Key Formula

Fn=22n+1F_n = 2^{2^n} + 1
Where:
  • FnF_n = The nth Fermat number
  • nn = A non-negative integer (0, 1, 2, ...)

How It Works

To check whether a Fermat number is prime, you first compute Fn=22n+1F_n = 2^{2^n} + 1. For small nn, you can test primality directly. Fermat himself conjectured that every Fermat number is prime, but Euler showed in 1732 that F5=4294967297=641×6700417F_5 = 4294967297 = 641 \times 6700417, disproving the conjecture. No additional Fermat primes beyond F4F_4 have ever been found, and it remains an open question whether infinitely many exist.

Worked Example

Problem: Determine whether the Fermat number F3F_3 is prime.
Step 1: Compute the exponent: 2n=23=82^n = 2^3 = 8.
23=82^3 = 8
Step 2: Compute the Fermat number: F3=28+1=256+1=257F_3 = 2^8 + 1 = 256 + 1 = 257.
F3=28+1=257F_3 = 2^8 + 1 = 257
Step 3: Test primality. Check divisibility by all primes up to 25716.03\sqrt{257} \approx 16.03: the primes 2, 3, 5, 7, 11, and 13 do not divide 257.
Answer: F3=257F_3 = 257 is a Fermat prime.

Why It Matters

Gauss proved that a regular polygon with nn sides can be constructed using only a compass and straightedge if and only if nn is a product of a power of 2 and distinct Fermat primes. This connects Fermat primes directly to classical geometric constructions. They also appear in areas of cryptography and coding theory where powers of 2 play a structural role.

Common Mistakes

Mistake: Assuming 2n+12^n + 1 can be prime for any odd nn that is not a power of 2.
Correction: If nn has an odd factor greater than 1, then 2n+12^n + 1 is always composite. For 2n+12^n + 1 to have a chance at being prime, nn must itself be a power of 2, which is why the formula uses 22k2^{2^k}.