primessieve-algorithm

Mairson's Sieve Space Complexity


In the paper Some New Upper Bounds on the Generation of Prime Numbers, Mairson outlines the algorithm below

Mairson's Sieve

He also says that the algorithm must store a doubly linked list at a cost of 2N logN, resulting in an O(N logN) space complexity. However looking at this algorithm, it only stores 3 arrays of size O(N). Where does this log(N) term come from?


Solution

  • Mairson's paper is focused on the bit-complexity of computing the prime numbers up to N. So the space complexity of O(N) words is equivalent to O(N log N) bits, because the numbers stored in the words have O(N) magnitude, thus requiring O(log N) bits. (You'll notice a B subscript to the big O in his notation. B for Bit-complexity.)