modulus



Debian wrote:
> How can I calculate  974^169 mod 28552  in maxima?
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima

You could do
modulus:28552
rat(974^169);

This might not be especially fast, depending on how
clever the powering program is, whether it notices the modulus.  YOu don't need
maxima, though.  In lisp, try

(defun sqr(x)(* x x))


  (defun $modexpt (a b m)
    (cond ((= b 0) 1)
((evenp b)(mod (sqr($modexpt a (/ b 2) m)) m))
(t
      (mod (* a ($modexpt a (1- b) m)) m))))

in which case your problem comes out 13616

You can call this program from maxima command line
as modexpt.