S. A. Fulling
Abstract:This is a pedagogical article cited in the foregoing research note, <a class="link-https" data-arxiv-id="quant-ph/9911050" href="https://arxiv.org/abs/quant-ph/9911050">quant-ph/9911050</a>
What problem does this paper attempt to address?
The problem that this paper attempts to solve is how to process and calculate those rapidly growing and very large integer sequences on a computer, especially when these recurrence relations cannot be solved in closed form. Specifically, the paper focuses on how to avoid calculation errors caused by integer overflows while maintaining the precision of calculations.
### Background
When calculating certain types of recurrence relations, for example:
\[ a_{n + 1}=a_{n}^{2}+(n + 3)na_{n}, \quad a_{0}=1 \]
The solutions of these recurrence relations grow rapidly, leading to overflow problems when representing these integers in a computer. Traditional fixed - precision floating - point numbers cannot meet the needs of precise calculations, and using software that supports arbitrary - length integers such as Maple or Mathematica can solve the problem, but it is not always a feasible method.
### Problem Description
1. **Integer Overflow**: When an integer exceeds the computer's natural "word length" (for example, 16 - bit or 32 - bit), it will cause an overflow. For example, the maximum value of a 16 - bit integer is \(2^{16}-1\), and the maximum value of a 32 - bit integer is \(2^{32}-1\).
2. **Requirement for Precise Calculation**: In some scientific research and engineering applications, precise integer calculation results are required, not just approximate values.
3. **Calculation Efficiency**: Although the traditional array representation method can handle large integers, it is less efficient in modern parallel computing environments because addition and multiplication operations need to handle carry and borrow bits one by one.
### Solution
The paper proposes a method based on modular arithmetic (especially the Chinese Remainder Theorem) to solve these problems. The main advantages of this method include:
- **Avoiding Overflow**: By decomposing large integers into representations under multiple smaller moduli, calculations can be carried out under each modulus, thereby avoiding overflow.
- **Parallel Computation**: Addition, subtraction, and multiplication operations in modular arithmetic can be carried out independently, which is suitable for parallel computation.
- **Mathematical Theory**: The mathematical theory behind this method is more abundant and interesting, providing more research directions.
### Specific Method
1. **Modular Arithmetic**: Select several relatively prime moduli \(m_{1}, m_{2}, \ldots, m_{R}\), and represent the large integer \(u\) as the residues \((u_{1}, u_{2}, \ldots, u_{R})\) under these moduli, where \(u_{i}=u\ \text{mod}\ m_{i}\).
2. **Chinese Remainder Theorem**: Using the Chinese Remainder Theorem, the original large integer \(u\) can be reconstructed from these residues.
3. **Algorithm Implementation**: By writing efficient algorithms and programs, implement the operations of modular arithmetic, including addition, subtraction, multiplication, and the final reconstruction step.
### Application Example
The paper mentions a specific example of calculating the factorial \(7!\). By choosing the moduli 13, 11, 9, and 7, the calculation can be completed without encountering a number greater than 256, and the result 5040 can be finally reconstructed from the residues.
### Conclusion
By introducing modular arithmetic and the Chinese Remainder Theorem, the paper provides an effective and precise method for handling large - integer calculations, which is especially suitable for scientific research and engineering applications that require high - precision calculations.