Skip to content

Fermat Primes: Definition and Examples

    A Fermat prime is a prime number that comes from a very specific formula: 2 raised to a power of 2, plus 1. The first few examples look simple, but the pattern quickly becomes one of the most famous cautionary examples in number theory.

    Definition

    A Fermat prime is a prime number of the form Fn = 22n + 1, where n is a non-negative integer.

    The number produced by this formula is called a Fermat number. It becomes a Fermat prime only when that Fermat number is actually prime.

    Fermat Prime Formula

    Fermat Number Formula

    Fn = 22n + 1

    In this formula, n starts at 0, not 1. That small detail matters because the exponent is itself a power of 2.

    When n = 0

    F0 = 21 + 1 = 3

    When n = 1

    F1 = 22 + 1 = 5

    When n = 2

    F2 = 24 + 1 = 17

    Examples of Fermat Primes

    The known Fermat primes are the first five Fermat numbers. They are:

    Known Fermat prime examples from the Fermat number formula.
    IndexFormula ValueFermat PrimeWhy It Qualifies
    F021 + 133 has exactly two positive divisors: 1 and 3.
    F122 + 155 has exactly two positive divisors: 1 and 5.
    F224 + 11717 is prime and matches the Fermat form.
    F328 + 1257257 is prime and follows the same formula.
    F4216 + 165,53765,537 is prime and is the largest known Fermat prime.

    Not Every Fermat Number Is Prime

    The early pattern is tempting: 3, 5, 17, 257, and 65,537 are all prime. It would be easy to expect the formula to keep producing prime numbers. It does not.

    Common Mistake

    A Fermat number is not automatically a Fermat prime. The formula creates a candidate number. Primality still has to be proven.

    The next Fermat number is:

    First Composite Fermat Number

    F5 = 232 + 1 = 4,294,967,297

    This number is composite because it has non-trivial factors. One factorization is 641 × 6,700,417.

    This example is useful because it separates two ideas that often get mixed together: a number can have a beautiful formula and still fail to be prime.

    Fermat Numbers vs Fermat Primes

    The terms are related, but they do not mean the same thing.

    Difference between Fermat numbers and Fermat primes.
    TermMeaningExamplePrime Requirement
    Fermat NumberAny number of the form 22n + 14,294,967,297No. It may be prime or composite.
    Fermat PrimeA Fermat number that is also prime65,537Yes. It must have exactly two positive divisors.

    Why Fermat Primes Are Special

    Fermat primes sit at the intersection of prime numbers, powers of 2, and classical number theory. Their formula is narrow, yet the numbers grow very fast.

    Growth Pattern

    The exponent doubles in a powerful way: 21, 22, 24, 28, 216, 232, and so on. This makes Fermat numbers become large much faster than ordinary arithmetic sequences.

    Fermat primes are also connected with constructible regular polygons. A regular polygon with a Fermat prime number of sides has a special place in classical geometry, especially when combined with powers of 2.

    How Fermat Primes Relate to Other Prime Concepts

    Fermat primes are a special family inside the larger set of prime numbers. They should not be confused with ordinary prime numbers, Mersenne primes, or numbers that merely pass a pattern filter.

    Checking Ordinary Prime Numbers

    Fermat primes are a special case. For a general whole number, you can use PrimeOrNot’s prime number checker to test whether it is prime, composite, or neither.

    Why the Formula Does Not Guarantee Primality

    The expression 22n + 1 creates numbers with a special shape, but shape alone is not a proof of primality. A formula can remove many impossible candidates while still allowing composite numbers.

    Math Note

    Passing a pattern test is weaker than being prime. A proven prime must have no positive divisors other than 1 and itself.

    This is similar to the rule that every prime greater than 3 can be written as 6n − 1 or 6n + 1. That rule filters possible prime candidates, but many numbers of those forms are composite.

    FAQ About Fermat Primes

    What Is a Fermat Prime?

    A Fermat prime is a prime number of the form Fn = 22n + 1, where n is a non-negative integer.

    What Are the Known Fermat Primes?

    The known Fermat primes are 3, 5, 17, 257, and 65,537.

    Is Every Fermat Number Prime?

    No. A Fermat number is any number made by the formula 22n + 1. It is called a Fermat prime only if that number is prime.

    What Is the First Fermat Number That Is Not Prime?

    F5 = 4,294,967,297 is the first Fermat number that is not prime. It factors as 641 × 6,700,417.

    Is 65,537 a Fermat Prime?

    Yes. 65,537 equals 216 + 1, which is F4, and it is prime.

    Are There More Fermat Primes?

    No additional Fermat primes are known beyond 3, 5, 17, 257, and 65,537. It is not known whether infinitely many Fermat primes exist or whether the known list is complete.