Add valuation, invmod, and is_pseudoprime