ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1456. Jedi Riddle 2

Something reminded me finding a square root modulo N
Posted by SPIRiT 9 Jun 2006 17:27
A^X=1 mod N;
if X is even, we can find quickly A^(X/2) (watch problem 1134).
If X is odd, we have to solve A*A^(X-1)/2=1 mod N. Therefore we have to find inverse number for A. And so on. Well, now, it's a fast quick recursion checking two cases...
Gonna check that soon...