I am using python pow(n,k,mod) to get the power sum of natural numbers, but not getting perfect time complexity. what i used
mod = 10**9+9
total = 0
for i in range(2, n):
x = pow(i, k, mod)
total += x
total = total%mod
return total
can u suggest any aglorithmic approach to solve power sum
( 1^k + 2^k + 3^k + 4^k .... n^k ) mod 1000000009
where k ranges from 1 to 1000 and n belong to natural number 1