i have a problem with this question..
Given n and m, calculate 1^1 + 2^2 + 3^3 + ... + n^n modulo m.
here i cant use power function directly as it only works for very very small inputs. Test your code on anything larger and you will get the wrong answer, since a double is not even precise enough to calculate the answer for n = 20, let alone n=10^18. (example: Math.pow(20,20) == Math.pow(20,20)+1.
what do i do now...