+ 1
Friends please help me how can I perform (x^y - 1)%n
Where x, y, n are very large numbers . I have used modular exponentiation , but it shows me wrong answer ! Plz give me a correct code !
2 Réponses
+ 2
If the number is larger than the data value can hold then you get an overflow and an incorrect result. If you’re using java try using long as your data type.
0
how to implement (x^y -1)%n .