Topics Register • News • History • How to • Sequences statistics • Template prototypes

# Pépin's test

## Introduction

Pépin's test is mainly used for proving the primality of Fermat numbers, but it is of no help for finding the factors of such numbers.

Pépin's test has been proven by French Father Pépin in 1877.

In his famous book about Édouard Lucas (page 101), HC Williams says: "The test that we today call Pépin's test is actually Proth's test with a proof provided by Lucas".

Pépin's test can also be used for proving the primality of other numbers, like the Generalized Fermat numbers $\displaystyle{ F_{n,2} = 4^{3^n}+2^{3^n}+1 }$ with k = 5 instead of k = 3.

## The Maths

Pépin's test says: If $\displaystyle{ n\gt 0 }$, $\displaystyle{ F_n = 2^{2^n}+1 }$ is a prime if and only if $\displaystyle{ \ 3^{(F_n-1)/2} \ \equiv -1 \ \pmod{F_n} }$.

## Bits of history

Pépin found the following:

If $\displaystyle{ F_n = 2^{2^n}+1 }$, then $\displaystyle{ F_n }$ is a prime if and only if $\displaystyle{ \ 5^{(F_n-1)/2} \equiv -1 \ \pmod{F_n} }$.

Then Lucas noticed that any number a can be used instead of 5 if $\displaystyle{ \left({a \atop {F_n}}\right) = -1 }$, where $\displaystyle{ \left({a \atop p}\right) }$ is the Jacobi symbol.

Proth in 1878 mentioned the use of 3 but was unable to provide a complete proof, but Lucas later supplied him with one.

Pépin also noted that this test can also be made into a simple Lucas-like test by defining $\displaystyle{ T_i=5^2 }$ and $\displaystyle{ T_{i+1}=T_i^2 }$.

$\displaystyle{ \ F_n }$ is a prime if and only if $\displaystyle{ F_n \ \mid \ T_{2^n-1}+1 }$.

And Lucas pointed out that the proof of sufficiency of Pépin's test followed from his fundamental theorem, with $\displaystyle{ \alpha = 5 \ , \ \beta = 1 }$.

The Fermat numbers $\displaystyle{ \ F_7 }$, $\displaystyle{ \ F_8 }$, $\displaystyle{ \ F_{13} }$, $\displaystyle{ \ F_{14} }$, $\displaystyle{ \ F_{17} }$, $\displaystyle{ \ F_{20} }$, $\displaystyle{ \ F_{22} }$, $\displaystyle{ \ F_{24} }$ and $\displaystyle{ \ F_{28} }$ were all originally proven composite by versions of Pépin's test. At present, there are still no known factors of $\displaystyle{ \ F_{20} }$, and $\displaystyle{ \ F_{24} }$. The smallest Fermat number with unknown primality status is the enormous $\displaystyle{ \ F_{33} }$ with 2,585,827,973 decimal digits. Unfortunately, performing Pépin's test on this number on our fastest computers would take centuries to run to completion!