# Last digits via PowerMod [closed]

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.

## closed as off-topic by J. M. will be back soon♦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. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

• "The book I'm following" - which book? In any event, Euler's theorem proceeds like this: PowerMod[2003, PowerMod[2002, 2001, EulerPhi[1000]], 1000]. – J. M. will be back soon Jan 21 '17 at 18:24
• @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. – BoLe Jan 21 '17 at 18:33
• Both results are correct. Why was there an expectation they might give the same result? – Daniel Lichtblau Jan 22 '17 at 17:31
• @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). – BoLe Jan 23 '17 at 18:40