Abstract
Generating prime numbers efficiently is a fundamental task in computational mathematics and cryptography. While the Sieve of Eratosthenes is a classic solution, its sequential nature and redundant operations pose challenges for distributed systems. This paper introduces a novel decentralized algorithm that combines the wheel sieve for efficient candidate generation with Scheduling by Multiple Edge Reversal (SMER) for robust process coordination. The resulting "WheelSieve-SMER" procedure is deadlock-free, avoids expensive GCD computations, and provides predictable time and message complexity for finding all primes up to a given integer $n$.
Introduction
The search for prime numbers remains a high-stakes computational challenge. Traditional methods like the Sieve of Eratosthenes are simple but inefficient, often flagging the same composite numbers multiple times. While "wheel sieves" improve upon this by skipping multiples of small primes, parallelizing them in a distributed environment typically introduces significant overhead due to synchronization needs and the risk of deadlocks.
This research addresses these bottlenecks by proposing a fully distributed prime-finding algorithm. By mapping the mathematical properties of the wheel sieve onto a graph-based coordination framework, the authors create a system that operates without a global clock or centralized controller.
Methodology
The core of the proposed system is the integration of two distinct mechanisms: the Wheel Sieve and SMER.
The Wheel Sieve
Based on Pritchard’s algorithm, the wheel sieve uses a reduced residue class—a "wheel"—representing numbers not divisible by the first $k$ primes. As this wheel "rolls" through the set of integers, it identifies "pseudo-primes," which are candidates for primality. This method is significantly faster than checking every integer because it inherently skips many composite numbers.
Scheduling by Multiple Edge Reversal (SMER)
To manage the distributed execution, the authors employ SMER, a graph-based dynamic for resource sharing. In this framework, processes are represented as nodes in a multigraph. A node can only perform its task when it becomes a "sink"—meaning all its connected edges point toward it. Upon completion, the node reverses the direction of its edges, allowing its neighbors to proceed. This mechanism ensures mutual exclusion and prevents starvation or deadlocks naturally.
The WheelSieve-SMER procedure maps the generation of pseudo-primes onto these periodic edge-reversal dynamics. The "ticks" of the distributed system are defined by the edge reversals themselves, creating a synchronized behavior without a global clock.
Key Insights
- GCD-Free Execution: A significant advantage of this algorithm is that its main execution loop does not require Greatest Common Divisor (GCD) calculations. By eliminating these computationally expensive operations, the algorithm maximizes performance in the inner loop.
- Natural Synchrony: Although the system is decentralized, the SMER framework provides an inherent "sense of time." This allows the distributed system to behave with the predictability of a synchronous one.
- Local Communication: Scalability is achieved because each process only communicates with its immediate neighbors in the multigraph, minimizing network congestion.
Complexity and Results
The theoretical evaluation of the algorithm demonstrates its efficiency:
- Time Complexity: The algorithm finds all primes up to $n$ in at most $n + \lfloor\sqrt{n}\rfloor$ time steps.
- Message Complexity: The total number of messages is bounded by $(n + \lfloor\sqrt{n}\rfloor)\Delta_N$, where $\Delta_N$ is the maximum degree of any node in the graph.
- Memory Footprint: Each process requires $O(n)$ bits of memory.
The authors note that the actual number of steps is often very close to the theoretical maximum, and they conjecture that the average-case efficiency may be even higher.
Conclusion and Future Work
The WheelSieve-SMER algorithm provides a robust, decentralized framework for prime generation. While this paper focuses on theoretical complexity, future work could involve empirical benchmarking on physical clusters to account for network latency. Furthermore, the authors suggest that this SMER-based approach is general enough to be adapted for other number-theoretic functions, such as Euler’s totient function or the Möbius function, potentially opening new avenues for distributed computational number theory.
Summary updated