Calculate sum of $(1^1 + 2^2 +.... + k^k)\bmod m$ in an efficient way??

119 Views Asked by At

I could calculate values of $1^1+\cdots$ for small numbers only. What if $k$ is a very large number maybe in order of $10^9$?