Unfortunately, Maxima seems to be distributed under the GPL, which means that we can't easily just take their code and add it to Racket.
Sam On Tue, Dec 11, 2012 at 8:52 AM, Jens Axel Søgaard <jensa...@soegaard.net> wrote: > 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 > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users > ____________________ Racket Users list: http://lists.racket-lang.org/users