ColdFury,
lets have an ex: 10^20
1: 10 mod 7 = 3
2: 10 mod 7 = 3
3 * 3 = 9 mod 7 = 2 == 100 mod 7
3: 10 mod 7 = 3
2 * 3 = 6 mod 7 = 6 == 1000 mod 7
4: 10 mod 7 = 3
6 * 3 = 18 mod 7 = 4 == 10000 mod 7
and so on....it may look simple for smaller exponents, but when u consider larger exponents , then u will see the difference.
another benchmark with a sample number given by me
Calculating 12321 ^ 934534 % 456456...

Calculating using My Algorithm...
Time Taken using Loop:125 ms
Result:258105...
my system is calculating still
