Fermat numbers

Fermat numbers are the integers

\[ F_n = 2^{2^n} + 1 \quad (n \ge 0). \]

They grow extremely quickly and are central to a classic “counterexample” story: Fermat conjectured that all \(F_n\) are prime, but \(F_5\) is composite (Euler). [Kř\'ıžek et al., 2013, Wikipedia contributors, 2025]

Key facts

What to experiment with

  • Factor hunting: Search for small prime factors of \(F_n\) (using modular arithmetic and wheel/primorial filters).

  • Pépin vs. trial division: Compare performance and failure modes as \(n\) increases.

  • Structure of known factors: Many known prime factors have the form \(k\cdot 2^{n+2} + 1\); explore how often such candidates appear.

  • Euclid-style numbers: Explore \(E_n = 1 + \prod_{i=0}^{n} p_i\) and compare “Euclid primes” vs. Fermat primes (they behave very differently).

References

See Kř\'ıžek et al. [2013], The OEIS Foundation Inc. [2025], Wikipedia contributors [2025].