1
$\begingroup$

Do you have an idea why this produces different results?

PowerMod[2003, 2002^2001, 1000]

241

PowerMod[2003, 2002 * 2001, 1000]

9

The book I'm following presents a somewhat convoluted solution and it gets to "241" for the last three digits. Reducing the base and utilizing Euler's theorem results to "009" though.

$\endgroup$

closed as off-topic by J. M. is away Jan 24 '17 at 4:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ "The book I'm following" - which book? In any event, Euler's theorem proceeds like this: PowerMod[2003, PowerMod[2002, 2001, EulerPhi[1000]], 1000]. $\endgroup$ – J. M. is away Jan 21 '17 at 18:24
  • $\begingroup$ @J.M. Oh, it's some exercise book on number theory in my mother tongue. In fact, I'm having difficulties with some Project Euler problems and I'm brushing up on the subject. $\endgroup$ – BoLe Jan 21 '17 at 18:33
  • $\begingroup$ Both results are correct. Why was there an expectation they might give the same result? $\endgroup$ – Daniel Lichtblau Jan 22 '17 at 17:31
  • 1
    $\begingroup$ @DanielLichtblau Arithmetic mistake I see now, 2003^(2002^2001), which is the problem, is not the same as (2003^2002)^2001 which is 2003^(2002*2001). $\endgroup$ – BoLe Jan 23 '17 at 18:40