Show the following if $p$ is prime

If $p$ is prime and $ a \ge 2$, prove that
d = (a – 1, \frac{a^p – 1}{a – 1}) =
p & \text{if } p \mid (a – 1)\\
1 & \text{if } p \nmid (a – 1) \, .

I was thinking that since $(a^p-1)/(a-1) = (a^{p-1}+a^{p-2}+…+1)$ if p divides a-1 then p should divide $(a^{p-1}+a^{p-2}+…+1)$ ??

Solutions Collecting From Web of "Show the following if $p$ is prime"

We find the remainder when the polynomial $f(x)=x^{p-1}+x^{p-2}+\cdots+1$ is divided by $x-1$. This is $f(1)$, which is $p$.

So the gcd of $a-1$ and $f(a)$ is the same as the gcd of $a-1$ and $p$, and we are finished.

Let $d=\gcd(a-1,\frac{a^p-1}{a-1})$, now let $q$ be a prime dividing $a-1$ and let $v_q(a-1)$ be the greatest power of $q$ dividng $a-1$,using the lifting’s exponent lemma we have:

  • If $q\neq p$ then $v_q\left(\frac{a^p-1}{a-1}\right)=0$ then $q$ does not divide $d$.
  • If $q=p$ then $v_q\left(\frac{a^p-1}{a-1}\right)=1$ so the greatest power of $p$ dividing $\frac{a^p-1}{a-1}$ is $p$ hence the power greatest power of $p$ dividing $d$ is $p$.

Finally $d=p$.