Find the sum of $\displaystyle 1 + i + i^2 + i^3+...+i^{16}$

Attempt:

$\displaystyle \sum_{k=0}^{n}ar^k$

$\displaystyle =\frac{a(1-r^{n+1})}{1-r}$

$\displaystyle =\frac{(1-i^{16+1})}{1-r}$

$\displaystyle =\frac{(1-i^{17})}{1-r}$

but the correct answer was 1