# modular-arithmetic: A type for integers modulo some constant.

[ bsd3, library, math ] [ Propose Tags ]

A convenient type for working with integers modulo some constant. It saves you from manually wrapping numeric operations all over the place and prevents a range of simple mistakes. Integer Mod 7 is the type of integers (mod 7) backed by Integer. We also have some cute syntax for these types like ℤ/7 for integers modulo 7.

Versions [faq] 1.0.0.0, 1.0.0.1, 1.0.1.0, 1.0.1.1, 1.1.0.0, 1.2.0.0, 1.2.1.0, 1.2.1.1, 1.2.1.2, 1.2.1.3, 1.2.1.4, 1.2.1.5, 2.0.0.0, 2.0.0.1 (info) CHANGELOG.md base (>4.9 && <5), typelits-witnesses (<0.5) [details] BSD-3-Clause Tikhon Jelvis Tikhon Jelvis Math https://github.com/TikhonJelvis/modular-arithmetic https://github.com/TikhonJelvis/modular-arithmetic/issues head: git clone git://github.com/TikhonJelvis/modular-arithmetic.git by TikhonJelvis at 2020-08-31T02:28:11Z NixOS:2.0.0.1 8138 total (18 in the last 30 days) 2.0 (votes: 1) [estimated by Bayesian average] λ λ λ Docs uploaded by userBuild status unknown

## Modules

[Index] [Quick Jump]

#### Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]

# 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