In my university website there is a PDF with some integrals and I found this formula for the integral of the secant function to any power: $$\int\sec^nx \mathrm dx=\frac{\tan x \sec^{n-2}x}{n-1}+\frac{n-2}{n-1}\int\sec^{n-2}x\mathrm dx \,\,\,\,\,\,\, (n\neq 1).$$
I searched for it on the internet, but I couldn't find anything. I know that it works for $n=2$ and for $n=3$, but I'm not sure if it works for any other power. Something like $n\in\mathbb N-\{1\}$ is never specified, but I assume that since $n$ is usually used for natural numbers.
Is that formula correct? And, if it is indeed correct, how do you prove it?