The term "generalized Fermat number" has two different definitions, one of which is more general than the other. Ribenboim (1996, pp. 89 and 359-360)
defines a generalized Fermat number as a number of the
form
with
,
while Riesel (1994) further generalizes, defining it to be a number
of the form
.
Both definitions generalize the usual Fermat numbers
.
The following table gives the first few generalized Fermat numbers for various bases
.
| OEIS | generalized
Fermat numbers in base | |
| 2 | A000215 | 3, 5, 17, 257, 65537, 4294967297, ... |
| 3 | A059919 | 4, 10, 82, 6562, 43046722, ... |
| 4 | A000215 | 5, 17, 257, 65537, 4294967297, 18446744073709551617, ... |
| 5 | A199591 | 6, 26, 626, 390626, 152587890626, ... |
| 6 | A078303 | 7, 37, 1297, 1679617, 2821109907457, ... |
For the form
with integers
and
, a generalized Fermat number can be prime
only for even
. An odd prime
has this form iff there exists an
integer
with
and
(Broadhurst 2006). Indeed, these conditions force
,
while
gives
.
Many of the largest known prime numbers are generalized Fermat numbers. Dubner found (10,861 decimal
digits) and
(10,071 decimal
digits) in September 1992 (Ribenboim 1996, p. 360). The largest known as
of Oct. 2026 for the form
is
, which has 13,426,224 decimal
digits and was found in Oct. 2025 (PrimePages 2026).
The following table gives the first few generalized Fermat primes for various even bases .
| prime | |
| 2 | 5, 17, 257, 65537, ... |
| 4 | 17, 257, 65537, ... |
| 6 | 37, 1297, ... |