A-13.1 Application: Residue Number System (RNS)

In a modern processor, each data size is a maximum of 64 bits. If the data size exceeds 64 bits, its computations can be handled efficiently by using the Chinese remainder theorem such that each co-prime modulus log2ni 64 (where N = n0 n1 nk) can be used to represent a big value a mod N as a𝑐𝑟𝑡 = (a0,a1,,ak), where a ai mod ni. Then, for any pair of big numbers a and b mod N, we can compute a + b mod N and a b mod N as follows:

Thus, the Chinese remainder theorem gives us the following useful formula:

Theorem A-13.2 Application of the Chinese Remainder Theorem

Suppose there are two big numbers a = i=0kaiyizi mod N and b = i=0kbiyizi mod N where N is a multiplication of co-primes n1n2nk, we have an isomorphism as follows:

a σa𝑐𝑟𝑡 = (a0,a1,,ak)

b σb𝑐𝑟𝑡 = (b0,b1,,bk)

Based on the above isomorphism, the following is true:

, where each element-wise addition/multiplication can be independently done modulo ni