Show that 1/p has period p-1 iff 10 is a primitive root mod p

346 Views Asked by At

I have this excersice, and i want verify my proof:

Let $p$ be a prime, then $1/p$ has period $p-1$ iff 10 is a primitive root $\mod p$.

My attempt:

$\rightarrow)$ Let $\frac{1}{p}=0,\overline{a_1\cdots a_{p-1}}:=0,\overline{m}$ where $m\in\mathbb{Z}$ then, multiplying by $10^{p-1}$, $\frac{10^{p-1}}{p}=m+\frac{1}{p}$ so $10^{p-1}=p\cdot m+1$, i.e., $10^{p-1}\equiv1\mod{p}$.

Now let $l<p-1$, so we have$$10^l\cdot\frac{1}{p}=a_1\cdots a_l,a_{l+1}\cdots a_{p-1}\overline{a_1\cdots a_{p-1}}=\frac{a_1\cdots a_{p-1}}{10^{p-l-1}}+\frac{10^{p-l-1}}{p}$$Then, multiplying by $p$ $$10^l=p\cdot(a_1\cdots a_{p-1})\cdot10^{1+l-p}+10^{p-l-1}:=p\cdot q+r$$Where $r\neq1$ for $l\neq p-1$.$\checkmark$

$\leftarrow)$ We know that period is at most $p-1$, suppose that is $s$ with $1\leq s<p-1$, and let $n:=a_1\cdots a_s$ be the repeating portion of decimal expansion of $1/p$ then \begin{equation} \frac{10^{p-1}}{p}=\underbrace{a_1\cdots a_sa_1\cdots a_{p-s-1}}_{p-1},\underbrace{a_{p-s}\cdots a_s}_{2s-p+1}\overline{a_1\cdots a_s}=n+\frac{n}{10^{p-s-1}}+\frac{10^{p-s-1}}{p} \end{equation} In the other hand 'cause 10 is a primitive root $\mod{p}$ then there exists $k\in\mathbb{Z}$ such that \begin{equation} \frac{10^{p-1}}{p}=k+\frac{1}{p} \end{equation}Therefore \begin{equation*}\begin{split} k+\frac{1}{p}&=n+\frac{n}{10^{p-s-1}}+\frac{10^{p-s-1}}{p}\Rightarrow\\ k&=n+\frac{n}{10^{p-s-1}}+(10^{p-s-1}-1)\frac{1}{p}\\ &=\underbrace{a_1\cdots a_sa_1\cdots a_{p-s-1},a_{p-s}\cdots a_s}_{2s}\overline{a_1\cdots a_s}-0,\overline{a_1\cdots a_s}\\ &=(a_1\cdots a_sa_1\cdots a_{p-s-1},a_{p-s}\cdots a_s)-(0,a_1\cdots a_sa_1\cdots a_s)\\ &=n+\left(\frac{n}{10^{p-s-1}}-\frac{n}{10^{s}}-\frac{n}{10^{2s}}\right)\\ &=\frac{n}{10^{2s^2(p-s-1)}}\cdot\left(10^{2s^2(p-s-1)}+10^{2s^2}-10^{2s(p-s-1)}-10^{s(p-s-1)}\right):=N\cdot K \end{split} \end{equation*} Where $K\in\mathbb{Z}$ but $N\not\in\mathbb{Z}$ thereupon $k\not\in\mathbb{Z}$, i.e., 10 isn't a primitive root $\mod{p}$, it is a contradiction. $\checkmark$

So, i'm very confussed in part 2, it is fine? in general the proof is correct?