Memory Efficient Arithmetic

Ernie Croot
DOI: https://doi.org/10.48550/arXiv.math/0302315
2003-03-21
Abstract:In this paper we give an algorithm for computing the mth base-b digit (m=1 is the least significant digit) of an integer n (actually, it finds sharp approximations to n/b^m mod 1), where n is defined as the last number in a sequence of integers s1,s2,...,sL=n, where s1=0, s2=1, and each successive si is either the sum, product, or difference of two previous sj's in the sequence. In many cases, the algorithm will find this mth digit using far less memory than it takes to write down all the base-b digits of n, while the number of bit operations will grow only slighly worse than linear in the number of digits. One consequence of this result is that the mth base-10 digit of 2^t can be found using O(t^{2/3} log^C t) bits of storage (for some C>0), and O(t log^C t) bit operations. The algorithm is also highly parallelizable, and an M-fold reduction in running time can be achieved using M processors, although the memory required will then grow by a factor of M.
Number Theory,Data Structures and Algorithms
What problem does this paper attempt to address?
The problem that this paper attempts to solve is: how to efficiently find the \(m\) -th \(b\)-ary digit of a positive integer \(n\), especially when directly storing and processing the entire number \(n\) requires a large amount of memory. Specifically, the paper proposes an algorithm that can calculate an arbitrary - precision approximation of the \(m\) -th \(b\)-ary digit of \(n\) without fully expanding \(n\). ### Core problems of the paper 1. **Objectives**: - Find a method to efficiently determine the \(m\) -th \(b\)-ary digit of a positive integer \(n\). - Especially in the case of limited memory, how to achieve this goal by calculating an approximation of \(n/b^{m}\bmod 1\). 2. **Challenges**: - Directly storing and processing a large integer \(n\) may require a large amount of memory, especially when \(n\) is very large. - Optimization in terms of time and space complexity is required to ensure the efficiency of the algorithm. ### Overview of the solution The paper proposes a method based on sequence operations that can efficiently calculate an approximation of \(n/b^{m}\bmod 1\). The main features of this algorithm include: - **High memory efficiency**: In many cases, the amount of memory required by this algorithm is much less than that required to directly store the \(b\)-ary representation of \(n\). - **Time complexity close to linear**: The time complexity of the algorithm (in terms of bit operations) is only slightly higher than the linear complexity of the length of the \(b\)-ary representation of \(n\). - **Highly parallelizable**: The algorithm can be executed in parallel by multiple processors, thereby significantly reducing the running time, although this will increase the memory requirements. ### Specific application scenarios A specific example given in the paper is: for a given \(t\), the \(m\) -th decimal digit of \(2^{t}\) can be found using \(O(t^{2/3}\log^{C}t)\) bits of memory and \(O(t\log^{C}t)\) bit operations. This result is especially applicable in the case of \(t = O(m^{3/2})\). ### Summary of mathematical expressions - \(\nu=\{n/b^{m}\}\), where \(\{\theta\}=\theta-\lfloor\theta\rfloor\) represents \(\theta\bmod 1\). - The goal of the algorithm is to find an approximation \(\gamma\) such that \(|\gamma - \nu|<\frac{1}{b^{y}}\), that is, \(\gamma\) is a \(y\)-level approximation of \(\nu\). Through this method, the paper provides an effective means of efficiently calculating the digits at specific positions of large integers in a memory - constrained environment.