On Mar 12, 2:45 pm, Tassilo Horn wrote:
> Mark Engelberg 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 unti
Also, I've not looked at any of the math code in clojure contrib, but
expressed as such, I wouldn't expect the idiom "(mod (expt n exp) m)"
to be at all fast for reasons largely independent of the numeric
implementation underneath.
Computing the entire power and then reducing it modulo m is going