Prove that $(n - 1)^2 \mid n^k -1$ if and only if $(n - 1) \mid k$ [duplicate]

I need help!

I need to prove that for any $2 \le n,k$ positive integers $(n - 1)^2 \mid n^k -1$ if and only if $(n - 1) \mid k$

Thanks!


Solution 1:

Hint: $n^k - 1 = (n-1)\left(1 + n + n^2 + \cdots + n^{k-1}\right)$

Solution 2:

By a preexisting theorem, the formula for the sum of geometric series is $$n^0+n^1+...+n^k=\frac{n^{k+1}-1}{n-1}$$ Since the sum is an integer, so is the ratio on the right, showing that $n-1$ divides $n^k-1$. Now, because of this formula, we know that $$(n-1)^2 \mid n^k-1$$ if and only if $$n-1 \mid \frac{n^{k}-1}{n-1}$$ or $$n-1 \mid n^0+n^1+...+n^{k-1}$$ Now we just need to prove that $$n-1 \mid n^0+n^1+...+n^{k-1}$$ if and only if $n-1 \mid k$.

It can be proven using induction that the quotient $$\frac{n^0+n^1+...+n^{k-1}}{n-1}$$ is equal to $$n^{k-2}+2n^{k-3}+3n^{k-4}+...+(k-2)n^{1}+(k-1)n^{0}+\frac{k}{n-1}$$ Which is an integer whenever the fractional part at the end is integral. That fractional part $$\frac{k}{n-1}$$ is only an integer when $n-1 \mid k$, proving the statement. QED.