sum p^n, n = 0 to k