nmod – integers mod wordsize n

class flint.nmod(val, mod)

The nmod type represents elements of Z/nZ for word-size n.

>>> nmod(10,17) * 2
3
is_zero(self)
modulus(self)
repr(self)
sqrt(self)

Return the square root of this nmod or raise an exception.

>>> s = nmod(10, 13).sqrt()
>>> s
6
>>> s * s
10
>>> nmod(11, 13).sqrt()
Traceback (most recent call last):
    ...
flint.utils.flint_exceptions.DomainError: no square root exists for 11 mod 13

The modulus must be prime.

str(self)