I'm trying to remember something that a math teacher told me many years ago about fractions. If I remember correctly he said that, in a fraction between integers, when the denominator is a multiple of $3$ or $7$, the result is a periodic number. Is this true? Are $3$ and $7$ the only numbers that produce periodic results? Bonus points for references and formal proofs. Thanks in advance.
Edit: Some examples:
$\frac{1}{4} = 0.25$, the result is not periodic
$\frac{1}{3} = 0.33\hat{3}$, the result is periodic
Edit 2: periodic in the sense of non-trivial infinite decimals. Hope this helps to understand what I mean. Probably periodic is not the best word.
Assume your number base is $b>1$ and that you are given a rational number $r={p\over q}>0$ with $(p,q)=1$, meaning that $p$ and $q$ have no common divisors.
When long division $p:q$ performed in base $b$ finally ends with zero remainder this means that there is an $n\geq0$ and a certain natural number $k$ such that $${p\over q}={k\over b^n}$$ or $$p\ b^n=q\ k\ .$$ As $(p,q)=1$ the denominator $q$ of the given rational number $r$ has to be a divisor of $b^n$ for sufficiently large $n$, and this means that $q$ may contain any prime divisors present in $b$ to arbitrary multiplicity, but no prime divisors prime to $b$. When $b=10$ then $q$ has to be of the form $q=2^j\ 5^k$ with $j\geq0$, $\ k\geq0$.
When $q$ is not of this form then the long division $p:q$ cannot end after a certain number of steps. Now in dividing by $q$ there are only $q-1$ different remainders $\ne0$. It follows that after a finite number of steps in the long division we have to meet a remainder we have seen before, say: $\ell$ steps ago. The consequence is that the whole computation will repeat from then on after every $\ell$ steps, so that in the end our $b$-adic fraction representing the rational $r$ becomes periodic with period $\ell$ (or smaller).
In elementary number theory these things are discussed in detail. In particular one treats the question, for which $q$ the resulting period has maximal length $q-1$. For $b=10$ one such number is $q=7$.