@hackage modular-arithmetic2.0.0.3
A type for integers modulo some constant.
Categories
License
BSD-3-Clause
Maintainer
Tikhon Jelvis <tikhon@jelv.is>
Links
Versions
Installation
Dependencies (2)
- base >4.9 && <5
- typelits-witnesses <0.5 Show all…
Dependents (5)
@hackage/acme-everything, @hackage/enumerate, @hackage/crypto-classical, @hackage/array-forth, @hackage/hmt
Modular Arithmetic
This package provides a type for integers modulo some constant, usually written as ℤ/n.
Here is a quick example:
>>> 10 * 11 :: ℤ/7
5
It also works correctly with negative numeric literals:
>>> (-10) * 11 :: ℤ/7
2
Modular division is an inverse of modular multiplication. It is defined when divisor is coprime to modulus:
>>> 7 `div` 3 :: ℤ/16
13
>>> 3 * 13 :: ℤ/16
7