ModInt

int with mod, mod must be prime

Constructors

this
this(int v)
Undocumented in source.
this
this(long v)
Undocumented in source.

Members

Functions

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

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

opOpAssign
auto opOpAssign(ModInt r)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

inv
ModInt inv(ModInt x)

return 1/x

make
auto make(uint x)
Undocumented in source. Be warned that the author may not have intended to support it.
normS
auto normS(uint x)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

v
uint v;
Undocumented in source.

Examples

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

Meta