I want to calculate the following sum in Haskell: (m + i)^n from i = m to n. So far I have thought of this:
sum2017 m n
|m > n = 0
|otherwise = (c + m)^n + sum2017 (m+1) n
where c = m
but the problem is that c changes every time due to getting assigned a new value from recursive calls