Skip to content

ResidueNumerals ​

A residue number system: the digits are n mod n \bmod each modulus, with no place values at all — which is what makes addition and multiplication carry-free and parallel. It is a bijection onto [0,∏mi)[0, \prod m_i) exactly when the moduli are pairwise coprime.

ResidueNumerals(moduli)the system for the given moduli
Typed signatures
TypePackageApplies
(list<integer>) -> valuenumeralsalways

Domain: Numeral systems

Examples

Basic #

42 mod 1642 \bmod 16 and 42 mod 62542 \bmod 625: no place values

live ↗
InIntegerDigits(42,ResidueNumerals([16,625]))\mathrm{IntegerDigits}(42, \mathrm{ResidueNumerals}(\bigl\lbrack16, 625\bigr\rbrack))Out[10,42]\bigl\lbrack10, 42\bigr\rbrack

100 mod 7100 \bmod 7 and 100 mod 11100 \bmod 11

live ↗
InIntegerDigits(100,ResidueNumerals([7,11]))\mathrm{IntegerDigits}(100, \mathrm{ResidueNumerals}(\bigl\lbrack7, 11\bigr\rbrack))OutIntegerDigits(100,ResidueNumerals([7,11]))\mathrm{IntegerDigits}(100, \mathrm{ResidueNumerals}(\bigl\lbrack7, 11\bigr\rbrack))
About
Examples2

See also: IntegerDigits, ResidueSystem