[racket] Math library ready for testing

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Dec 11 08:52:39 EST 2012

2012/12/11 Jens Axel Søgaard <jensaxel at soegaard.net>:
> 2012/12/11 Jens Axel Søgaard <jensaxel at soegaard.net>:
>> Here is what Maxima does (line 628 and below):
>>
>> https://github.com/andrejv/maxima/blob/master/src/ifactor.lisp
>
> I have attached a port in the attached file. The new primality
> tester is called new-prime? and the old one prime?.
> The old one seems to be faster on the simple
> "sum primes below a million test".
>
> (time (for/sum ([n (in-range 1000000)]
>                 #:when (new-prime? n))
>         n))
>
> ; cpu time: 31264 real time: 31427 gc time: 340
> ; 37550402023
>
> (time (for/sum ([n (in-range 1000000)]
>                 #:when (prime? n))
>         n))
>
> ; cpu time: 8944 real time: 9079 gc time: 257
> ; 37550402023
>
> --
> Jens Axel Søgaard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prime-from-maxima.rkt
Type: application/octet-stream
Size: 8266 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20121211/200f7373/attachment.obj>

Posted on the users mailing list.