Overview

modular arithmetic


Show Summary Details

Quick Reference

Arithmetic based on the concept of the congruence relation defined on the integers and used in computing to circumvent the problem of performing arithmetic on very large numbers.

Let m1, m2,…, mk be integers, no two of which have a common factor greater than one. Given a large positive integer n it is possible to compute the remainders or residues r1, r2,…, rk such that nr1 (mod m1) nr2 (mod m2)…nrk (mod mk) Provided n is less thanm1 × m2 × … × mkn can be represented by(r1,r2,…,rk)This can be regarded as an internal representation of n. Addition, subtraction, and multiplication of two large numbers then involves the addition, subtraction, and multiplication of corresponding pairs, e.g.(r1,…,rk) + (s1,…,sk) = (r1 + s1, …, rk + sk)Determining the sign of an integer or comparing relative magnitudes are less straightforward.

nr1 (mod m1)

nr2 (mod m2)

nrk (mod mk)

m1 × m2 × … × mk

(r1,r2,…,rk)

(r1,…,rk) + (s1,…,sk) = (r1 + s1, …, rk + sk)

Subjects: Computing.


Reference entries

Users without a subscription are not able to see the full content. Please, subscribe or login to access all content.