Commit Graph

7 Commits (db42e128538f32bb3399f5469866d1b3553ecea3)

Author SHA1 Message Date
John Benediktsson ad71f79be3 math.primes: speedup sieve. 2014-12-04 10:11:32 -08:00
John Benediktsson eaa19eb36f math.primes.erato: minor performance improvements. 2012-10-23 10:49:45 -07:00
John Benediktsson dd2a5729a7 math.primes.erato: bit faster by inlining. 2012-08-23 09:35:09 -07:00
Rupert Swarbrick cd28c7a219 math.primes.erato: Fix off-by-one error
The sieve bit vector deals with numbers in chunks of 30. Therefore,
the number 90 (say) is the 91st 'element' of the vector. Each byte
deals with some range {0,1,...,29}+30n so to have the number 90, you
need four bytes.

Rather pleasingly, I bumped into this bug and it reduced to the
incantation:
  2010 2010 sieve marked-prime?
2010-11-02 17:34:24 +01:00
Doug Coleman 4a3d63e00a use if-zero in a few more places 2009-08-11 18:15:53 -05:00
Samuel Tardieu 41d804ddbd Pack primes numbers by slices of 30
In any given 30 successive integers greater than 5, there are at most
8 prime numbers. Use this to tightly pack the result of the Eratostene
sieve. This lets us store more prime numbers than before in less space.
2009-06-24 13:15:12 +02:00
Samuel Tardieu 594bd3aee8 Move math.primes from extra to basis 2009-01-07 21:12:48 +01:00