2012/12/11 Jens Axel Søgaard <jensa...@soegaard.net>: > 2012/12/11 Jens Axel Søgaard <jensa...@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
prime-from-maxima.rkt
Description: Binary data
____________________ Racket Users list: http://lists.racket-lang.org/users