polynomials_on_simplices.algebra.modular_arithmetic module

Functionality for modular arithmetic.

class IntegerModuloN(value, n)[source]

Bases: object

Integer modulo n (element of \(\mathbb{Z}/n\mathbb{Z})\).

We have

\[\mathbb{Z}/n\mathbb{Z} = \mathbb{Z}/\sim,\]

where

\[a \sim b \text{ if } a \bmod n = b \bmod n \iff \exists c \in n\mathbb{Z} \text{ such that } a + c = b.\]

This class defines the ring structure of integers modulo n.

Addition:

\[+ : \mathbb{Z}/n\mathbb{Z} \times \mathbb{Z}/n\mathbb{Z} \to \mathbb{Z}/n\mathbb{Z},\]
\[[a] + [b] = [a + b].\]

Multiplication:

\[\cdot : \mathbb{Z}/n\mathbb{Z} \times \mathbb{Z}/n\mathbb{Z} \to \mathbb{Z}/n\mathbb{Z},\]
\[[a] \cdot [b] = [a \cdot b].\]
Parameters:
  • value – Value of the integer.
  • n – Modulus of the integer.