1.2.6. Example: Testing for Primality
Exercise 1.25

Extra work

Alyssa P. Hacker complains that we went to a lot of extra work in writing expmod. After all, she says, since we already know how to compute exponentials, we could have simply written


(define (expmod base exp m)
  (remainder (fast-expt base exp) m))

Is she correct? Would this procedure serve as well for our fast prime tester? Explain.



There are no comments yet.

Authentication required

You must log in to post a comment.

Login