Fermat witness

maths
Fermat Witness

For a number $r \in \mathbb{N}$ a Fermat witness is a value $0 < z < r-1$ such that

$$z^{r-1} \not = 1 \ (mod \ r).$$

Such a Fermat witness is called trivial if $gcd(z,r) > 1$ and non-trivial otherwise.