From 537eab734cabdafd8757bdf49ac09762c798a40a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 7 Feb 2019 11:28:33 +0000 Subject: [PATCH] pock: Set the sieve vector size correctly. Having calculated `sievesz' so carefully, it seems a shame not to use it -- especially when that results in the sieve vector being thirty times larger than it should be. More seriously, this causes the `smallprimes' iterator to continue way past its proper end-point. Fortunately, all of the uses in this program are safe. --- pock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pock b/pock index 3d9f66b..cb49996 100644 --- a/pock +++ b/pock @@ -239,7 +239,7 @@ class Sieve (object): n = (limit - 2)/2 sievesz = (n + me._NBIT - 1)/me._NBIT me._sievemax = sievesz*me._NBIT - me._bits = n*[0] + me._bits = sievesz*[0] ## This is standard Sieve of Eratosthenes. For each index i: if ## bit i is clear, then p = 2 i + 3 is prime, so set the bits -- 2.11.0