Prime number module

Tim Hochberg tim.hochberg at ieee.org
Wed Oct 1 11:47:59 EDT 2003


Lulu of the Lotus-Eaters wrote:
[SNIP]
> FWIW, bzip2 doesn't do much better either.  I'd be kinda surprised at
> this point if another representation of the primes under 10^8 actually
> did better[**].  I proposed listing the gaps as a strategy; but given
> that there are 5.7 million gaps to list, it's hard to beat 3.8 megs.
> Maybe encoding gaps in nibbles-with-escaping would work.  But now I'm
> fond of the speed of the bit array.
[SNIP]

FWIW, using escaped nibbles plus compression put me down around 3.4 
megs. This includes storing enough metadata to do fast how many primes 
below n testing. Much slower for straight primality testing than the 
bitmap scheme though.

-tim





More information about the Python-list mailing list