Prove $10^{P(n)/2}+1$ is divisible by $n$

decimal-expansiondivisibilityelementary-number-theorymodular arithmetic

Let $P(n)$ be the period of the decimal expansion of $\frac{1}{n}$, i.e., $P(7)=6$. Prove that, if $P(n)$ is even, then $10^{P(n)/2}+1$ is divisible by $n$.

My approach so far has been to note that
$$\frac{1}{n}=\frac{\varphi}{10^{P(n)}-1}\tag{1}$$
Where $\varphi$ is the repeating digits of the decimal expansion, for $n=7$, $\varphi=142857$ for example.

The problem can also be thought as proving
$$a=\frac{10^{P(n)/2}+1}{n}\tag{2}$$
is an integer

Substituting (1) in (2) gives
$$a=\varphi \frac{10^{P(n)/2}+1}{10^{P(n)}-1}$$
if $P(n)=2T$, then
$$a=\varphi \frac{10^{T}+1}{10^{2T}-1}$$
$$a=\varphi \frac{10^{T}+1}{(10^{T}-1)(10^{T}+1)}$$
$$a=\frac{\varphi}{10^{T}-1}$$
But I've not been able to go further than that on how to prove $a$ is an integer.

Best Answer

That is not generally true.


Consider $n=21$ then $$\frac{1}{21}=0.\overline{047619}$$ thus $P(21)=6$. However $$10^3+1\equiv 14 \pmod{21}$$


Another example is $n=13\cdot17=221$, then $P(221)=48$ and $$10^{24}+1\equiv 119 \pmod{221}$$


However, the statement is true if $n$ is prime, different from $2$ or $5$. This is because $P(n)=ord_{n}(10)$ (from the definition of multiplicative order, also see this post and this). From $(1)$ in your post $$10^{P(n)} \equiv 1 \pmod{n} \Rightarrow n\mid \left(10^{\frac{P(n)}{2}}+1\right)\cdot\left(10^{\frac{P(n)}{2}}-1\right)$$ Using Euclid's lemma, if we assume $n \mid 10^{\frac{P(n)}{2}}-1$, then $\frac{P(n)}{2}\geq ord_n(10)=P(n)$ which is a contradiction. As a result $$n\mid 10^{\frac{P(n)}{2}}+1$$

Related Question