On Mar 12, 2:45 pm, Tassilo Horn <tass...@member.fsf.org> wrote:
> Mark Engelberg <mark.engelb...@gmail.com> writes:
>
> Hi Mark,
>
> >> For number theory you often need things like
>
> >>    (mod (expt n exp) m)
>
> > Yes, and to make things like this fast, the trick is to perform the
> > mod at each multiplication step, rather than waiting until the end.
>
> So now I added this suggestion and the test is now really, really fast.
> I tried some really big primes from the list of prime numbers on
> wikipedia, and it always finishes instantly.  And what's best: the
> results seem to be correct, too. ;-)

Glad your problem is resolved.  Miller-Rabin is quite zippy...  and
practical for real use.  If you want a next cool exercise to take a
crack at, the direction one often goes is to improve the speed of the
underlying multiplications using the FFT...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to