a / b (mod n)
, or None
if b
is not invertible modulo n
.
pub fn u256_div_mod_n(a: u256, b: u256, n: NonZero) -> Option
use core::math::u256_inv_mod;
let result = u256_div_mod_n(17, 7, 29);
assert!(result == Some(19));
Was this page helpful?