Fermat Witness

For a number a Fermat witness is a value such that Such a Fermat witness is called trivial if and non-trivial otherwise.