title: How can one verify the proper operation of a sieve close to 2^64?
body: <p>Small primes - up to about 1,000,000,000,000 - are readily available from various sources. The <a href="http://primes.utm.edu/" rel="nofollow noreferrer">Prime Pages (utm.edu)</a> have lists for the first 50 million primes, <a href="http://www.primos.mat.br/" rel="nofollow noreferrer">primos.mat.br</a> goes up to 10^12, and programs like the one available at <a href="http://primesieve.org/" rel="nofollow noreferrer">primesieve.org</a> go even higher.</p>
  
  <p>However, when it comes to numbers close to 2^64 there's only the ten primes mentioned on the page <a href="https://primes.utm.edu/lists/2small/0bit.html" rel="nofollow noreferrer">Primes just less than a power of two</a> at primes.utm.edu and that seems to be it.</p>
  
  <p>The <a href="http://primes.utm.edu/curios/includes/primetest.php" rel="nofollow noreferrer">primality test</a> found there refuses to work on numbers that don't fit a double, others - elsewhere - fail to refuse and just print trash. The primesieve.org program refuses to work with numbers that aren't at least some 40 billion below 2^64, which doesn't exactly inspire confidence in the quality of their coding. The same result everywhere: nada, zilch, niente.</p>
  
  <p>The cogs and gears of sieves start creaking around the 2^62 mark, and close to 2^64 there's hardly a cog that doesn't creak loudly threatening to break apart. Hence the need for testing the implementation is greatest where verification is most difficult, because of the scarcity/absence of reliable reference data. The primesieve.org program seems to be the only one that works at least up to 2^63 or thereabouts, but I don't trust it too much because of the above-mentioned issue.</p>
  
  <p>So how then can one verify the proper operation of a sieve close to 2^64? Are there reliable lists somewhere for a million (or ten million or a hundred million) primes just below and above powers of two like 2^64, 2^63 and so on? Or are there reliable (trustworthy, verified, banged-on a lot) programs that yield such sequences or that can verify primes or lists of primes?</p>
  
  <p>Once a sieve has been verified it can be used to produce handy lists with <a href="https://stackoverflow.com/questions/26606355/checksumming-large-swathes-of-prime-numbers-for-verification">sums/checksums</a> for loads of interesting ranges, but absent such lists the situation seems difficult...</p>
  
  <p>P.S.: I determined the upper limit for the <a href="http://primesieve.org/" rel="nofollow noreferrer">primesieve.org turbo siever</a> to be <code>UINT64_MAX - 10 * UINT32_MAX</code>, or 0xFFFFFFF600000009. That means only the 10 * UINT32_MAX highest primes don't have any reference data at all so far...</p>