How do I simplify the following:
$a^{b} \ \pmod {b}$ where $b$ is very large.
For example:
$2^{499} \pmod {999}$
How do I find the result without computing all?
I don't want to use such a quantity of memory for storing the value of $2^{499}$.
Is there any sort of property to find the result in a faster way?
pow(2, 499, 999)
. – Peter Foreman Oct 17 '19 at 21:35