DModInt

int with mod, mod can be setted in execute time. mod don't have to be prime.

Members

Functions

opBinary
auto opBinary(DModInt r)
auto opBinary(DModInt r)
auto opBinary(DModInt r)
auto opBinary(DModInt r)

整数型と同じように演算可能 割り算のみ遅い

Static functions

inv
DModInt inv(DModInt x)

xの逆元を求める

Examples

1 alias Mint1 = DModInt!"mod1";
2 alias Mint2 = DModInt!"mod2";
3 Mint1.MD = 7;
4 Mint2.MD = 9;
5 assert((Mint1(5)+Mint1(5)).v == 3); // (5+5) % 7
6 assert((Mint2(5)+Mint2(5)).v == 1); // (5+5) % 9    

Meta