Fundamental Programming with Java

$$\frac{x^n-1}{x-1} = \sum_{k=0}^{n-1}x^k$$