a modulo n, or None if a is not invertible modulo n.
All as will be considered not invertible for n == 1.
a modulo n, or None if a is not invertible modulo n.
All as will be considered not invertible for n == 1.
pub fn u256_inv_mod(a: u256, n: NonZero) -> Option>
use core::math::u256_inv_mod;
let inv = u256_inv_mod(3, 17);
assert!(inv == Some(6));
Was this page helpful?