ModInt

int with mod, mod must be prime

Members

Functions

opBinary
auto opBinary(ModInt r)
auto opBinary(ModInt r)
auto opBinary(ModInt r)
auto opBinary(ModInt r)
auto opBinary(T r)

We can handle it as same as int(but divide is slow)

Static functions

inv
ModInt inv(ModInt x)

return 1/x

Examples

1 alias Mint = ModInt!(107);
2 assert((Mint(100) + Mint(10)).v == 3);
3 assert(( Mint(10) * Mint(12)).v == 13);
4 assert((  Mint(1) /  Mint(2)).v == 108/2);
5 assert((Mint(2) ^^ 7).v == 21);

Meta