1
vote
1answer
252 views

How to effectively compute a periodic function?

I'm writing a program to compute a value of periodic function for any arbitrary large argument: $f(k) = (\sum_{n=1}^{2^k} n)\mod\ (10^9 + 7)$, where $n,k \in \mathbb{N} $ I know that $ f(k + P) = ...