I am currently writing a program that requires the calculation of:
(x^2) mod y
Both these numbers are integers. Both can be large numbers, though they never exceed 10^9.
That is still enough to overflow integer for x squared. Speed is crucial for this code so gradual multiplication is not usable.
Thank you.