You are viewing a single comment's thread. Return to all comments →
shouldn't there be
product = product%123456
after the loop.
I have studied
(A * B) mod C = (A mod C * B mod C) mod C
It's because in this case you know B is already mod C, so you calculate (A mod C * B) mod C. In fact, mike's code started with 1, so it's actually ((1 * A) mod C * B) mod C