The term "Fermat number" has two definitions. The less common is a number of the form obtained by setting
in a Fermat-Lucas
polynomial for positive integers
, the first few of which are 3, 5, 9, 17, 33, ... (OEIS
A000051).
The much more commonly encountered Fermat numbers are a special case, given by the binomial number of the
form . The first few for
, 1, 2, ... are 3, 5, 17, 257, 65537, 4294967297,
... (OEIS A000215). The number of digits
for a Fermat number is
|
(1)
| |||
|
(2)
| |||
|
(3)
|
where
denotes the base-10 logarithm and
is the floor function.
For
, 1, ..., the numbers of digits
in
are therefore 1, 1, 2, 3, 5, 10, 20,
39, 78, 155, 309, 617, 1234, ... (OEIS A057755).
The numbers of digits in
for
, 1, ... are 1, 309, 381600854690147056244358827361,
... (OEIS A114484).
Being a Fermat number is the necessary (but not sufficient) form a number
|
(4)
|
with
must have in order to be prime. This can be seen
by noting that if
is to be prime, then
cannot have any odd factors
or else
would be a factorable number of
the form
|
(5)
|
Therefore, for a prime ,
must be a power of 2. No two Fermat
numbers have a common divisor greater than 1 (Hardy and
Wright 1979, p. 14). Their reciprocal sum
is the reciprocal Fermat constant.
Fermat conjectured in 1650 that every Fermat number is prime and Eisenstein proposed as a problem in 1844 the proof
that there are an infinite number of Fermat
primes (Ribenboim 1996, p. 88). At present, however, only composite
Fermat numbers
are known for
. An anonymous writer proposed that numbers of the form
,
,
were prime. However,
this conjecture was refuted when Selfridge (1953)
showed that
|
(6)
|
is composite (Ribenboim 1996, p. 88).
The only known Fermat primes are
|
(7)
| |||
|
(8)
| |||
|
(9)
| |||
|
(10)
| |||
|
(11)
|
(OEIS A019434).
Factoring Fermat numbers is extremely difficult as a result of their large size. In fact, as of 2026, only to
have been completely factored. The number of factors
for Fermat numbers
for
, 1, 2, ... are 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 5,
... (OEIS A046052). Written out explicitly,
the complete prime factorizations are
|
(12)
| |||
|
(13)
| |||
|
(14)
| |||
|
(15)
| |||
|
(16)
| |||
|
(17)
| |||
|
(18)
|
(OEIS A050922). Here, the final large prime is not explicitly given since it can be computed by dividing by the other given factors. The
following table summarizes the properties of these completely factored Fermat numbers.
| digits | factors | digits | reference | |
| 5 | 10 | 2 | 3, 7 | Euler 1732 |
| 6 | 20 | 2 | 6, 14 | Landry 1880 |
| 7 | 39 | 2 | 17, 22 | Morrison and Brillhart 1975 |
| 8 | 78 | 2 | 16, 62 | Brent and Pollard 1981 |
| 9 | 155 | 3 | 7, 49, 99 | Manasse and Lenstra (In Cipra 1993) |
| 10 | 309 | 4 | 8, 10, 40, 252 | Brent 1995 |
| 11 | 617 | 5 | 6, 6, 21, 22, 564 | Brent 1988 |
For , 2, ..., the smallest factors
of the Fermat numbers are 5, 17, 257, 65537, 641, 274177, 59649589127497217, 1238926361552897,
2424833, ... (OEIS A093179), while the largest
are 5, 17, 257, 65537, 6700417, 67280421310721, 5704689200685129054721, ... (OEIS
A070592).
Other tables of known factors of Fermat numbers are given by Keller (1983), Brillhart et al. (1988), Young and Buell (1988), Riesel
(1994), and Pomerance (1996). A current list of the known factors
of Fermat numbers is maintained by Keller. In these tables, since all factors
are of the form , the known factors
are expressed in the concise form
.
As of 2026,
has 6 known factors with C1133 remaining (where C
denotes a composite
number with
digits),
has 4 known factors with C2391
remaining,
has one known factor with C4880 remaining, and
has three known factors with
C9808 remaining (Keller).
By the early 1980s,
was known to be composite for all
with the exceptions
, 22, 24, 28, and 31 (Riesel 1994, Crandall et
al. 2003). Young and Buell (1988) discovered that
is composite, Crandall
et al. (1995) that
is composite, and
Crandall et al. (2003) that
is composite (Crandall
1999; Borwein and Bailey 2003, pp. 7-8; Crandall et al. 2003). In 1997,
Taura found a small factor of
(Crandall et al. 2003, Keller), and a small factor of
was also found. As of 2026, it is known that
is composite for all
(cf. Crandall et al.
2003).
There are currently two Fermat numbers that are known to be composite, but for which no single factor is known: and
(Keller; cf. Crandall et al. 2003).
Ribenboim (1996, pp. 89 and 359-360) defines generalized Fermat numbers as numbers of the form with
even, while Riesel (1994, pp. 102 and 415) defines
them more generally as numbers of the form
.
Fermat numbers satisfy the recurrence relation
|
(19)
|
For ,
can be shown to be prime iff it satisfies Pépin's test.
Pépin's theorem
|
(20)
|
is also both necessary and sufficient.
In 1770, Euler showed that any prime factor of for
must have the form
|
(21)
|
where
is a positive integer. In 1878, Lucas increased
the exponent of 2 by one, showing that prime
factors of Fermat numbers must be of the form
|
(22)
|
for . Prime factors
of Fermat numbers are therefore Proth primes since
they are of the form
, as long as they also
satisfy the additional condition
odd and
.
If
|
(23)
|
is the factored part of
for
(where
is the cofactor to be tested for primality), compute
|
(24)
| |||
|
(25)
| |||
|
(26)
|
Then if , the cofactor is a probable
prime to the base
;
otherwise
is composite.
A regular polygon with sides is a constructible
polygon iff
|
(27)
|
where
is a nonnegative integer and the
are zero or more distinct Fermat
primes, as stated by Gauss and first published by Wantzel (1837). This is equivalent
to the statement that the trigonometric functions
and
can be computed in terms of finite numbers of additions, multiplications,
and square root extractions iff
is of the above form.
The last digits of
(where
is the smallest integer such that
has at least
digits) are eventually
periodic for
, 2, ... with periods 1, 4,
20, 100, 500, 2500, ... (OEIS A005054; Koshy
2002-2003).