fact: Fixpoint pow_mod (a m n : positive) {struct m} : N := match m with | xH => (a mod n)%P | xO m' => let z := pow_mod a m' n in match z with | N0 => 0%N | Npos z' => ((square z') mod n)%P end | xI m' => let z := pow_mod a m' n in match z with | N0 => 0%N | Npos z' => (((square z') * a)%P mod n)%P end end.
imports: List ZArith Zorder ZCAux LucasLehmer Pocklington ZCmisc Pmod