fact: Fixpoint egcdn_rec m n s qs := if s is s'.+1 then let: (q, r) := edivn m n in if r > 0 then egcdn_rec n r s' (q :: qs) else if odd (size qs) then qs else q.-1 :: qs else [::0].
imports: mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat seq)