A residue number system (RNS) represents a large integer using a set of smaller integers, so that computation may be performed more efficiently. It relies on the Chinese Remainder Theorem of modular arithmetic for its operation, a mathematical idea from Sun Tsu SuanChing (Master Sun’s Arithmetic Manual) in the 4th century AD. Computation can be defined as finding a solution to a problem from given inputs by means of an algorithm. ...
link titleThe Chinese remainder theorem (CRT) is the name for several related results in abstract algebra and number theory. ...
Modular arithmetic is a system of arithmetic for integers, where numbers wrap around after they reach a certain value â€” the modulus. ...
Defining a residue number system
A residue number system is defined by a set of N + 1 integer constants, {m_{0}, m_{1}, m_{2}, ... m_{N} }, referred to as the moduli. The moduli must all be coprime; so in particular no modulus may be a factor of any other. Let M be the product of all the m_{i}. Coprime  Wikipedia /**/ @import /skins1. ...
Any arbitrary integer X smaller than M can be represented in the defined residue number system as a set of N + 1 smaller integers  {x_{0}, x_{1}, ... x_{N}}
with  x_{i} = X modulo m_{i}
representing the residue class of X to that modulus. In computing, the modulo operation finds the remainder of division of one number by another. ...
The integer X can then be recovered from the set of the x_{i} integers via the Chinese remainder theorem. link titleThe Chinese remainder theorem (CRT) is the name for several related results in abstract algebra and number theory. ...
Operations on RNS numbers Once represented in RNS, many arithmetic operations can be efficiently performed on the encoded integer. For the following operations, consider two integers, A and B, represented by a_{i} and b_{i} in an RNS system defined by m_{i} (for i from 0 ≤ i ≤ N).
Addition and subtraction Addition can be accomplished by simply adding the small integer values together, modulo their specific moduli. For example, a sum can be computed by calculating a set of sum_{i} values such that:  sum_{i} = ( a_{i} + b_{i} ) % m_{i}
Similarly, subtraction works the same way:  diff_{i} = (a_{i}  b_{i} ) % m_{i}
Multiplication Multiplication can be accomplished in a manner similar to addition and subtraction. To calculate PROD = A * B, we can calculate:  prod_{i} = ( a_{i} * b_{i} ) % m_{i}
Division Division in residue number systems is problematic. A paper describing one possible algorithm is available at [1]
See also In mathematics, a covering system is a collection of finitely many residue classes whose union covers all integers. ...
Practical applications RNS have applications in the field of digital computer arithmetic. By decomposing in this a large integer into a set of smaller integers, a large calculation can be performed as a series of smaller calculations that can be performed independently and in parallel. Because of this, it's particularly popular in hardware implementations. A digital system is one that uses numbers, especially binary numbers, for input, processing, transmission, storage, or display, rather than a continuous spectrum of values (an analog system) or nonnumeric symbols such as letters or icons. ...
