[racket] Math library ready for testing

From: Stephen Bloch (bloch at adelphi.edu)
Date: Tue Dec 11 07:09:03 EST 2012

On Dec 11, 2012, at 6:01 AM, Jens Axel Søgaard wrote:

> For a small (less than 10000)  number n  prime? looks up primality of
> with a simple (vector-ref small-primes n).
> 
> For a large number (greater than 10000) a pseudo prime test is used.
> 
> Originally the limit for small primes was a million, but that limit is too
> large for a general purpose library.


Would it perhaps make more sense for small-primes to contain primes themselves, in increasing order so one can be found by binary search, rather than booleans?  The O(1) behavior would be replaced by O(log(limit)), but perhaps you would save enough memory to put the limit higher.

Stephen Bloch
sbloch at adelphi.edu



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121211/d8435e0f/attachment-0001.html>

Posted on the users mailing list.