Skip to main content
GameDev.net gamedev.net
🔒 Locked

problem to solve

Started by matt0r Apr 4, 2005 at 9:31 AM 0 replies 700+ views
Original Post
matt0r
matt0r
write a recursive O(nlogn) algorithm whose parameters are 3 integers x, n, and p and which computes the remainder when x^n is divided by p. For simplicity you may assume n is a power of 2. that is n=2^k for some positive int k
Tjoppen
Tjoppen
Sounds like homework...

Just use ye olde product of modulus squares for aquiring the answer. If you're smart you only need to code addition/binary shift if the problem requires bignum.
delete this;

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.