a^k % n = (a%n)^k
(a+b) % n = a%n + b%n
(n+1)^(n-1) % n = [ (n+1) % n ] ^ (n-1) = [ n % n +1 % n ] ^ (n-1) = [ 0 + 1 ] ^ (n-1) = 1
(n-1)^(n+1) % n = [ (n-1) % n ] ^ (n+1) = [ n % n - 1 % n ] ^ (n+1) = [ 0 - 1 ] ^ (n+1) = -1
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
How to solve a trigonometry equation | 6 | 86 | |
Probability Calculation | 2 | 54 | |
Least Squares Curve Fitting | 4 | 57 | |
How to access ANSI/IEEE Std 754 or equivalent information ? | 3 | 43 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
16 Experts available now in Live!