Let have order modulo . Then the base expansion of has period of length . To see this, note that if , then

.

Note also that for any . Hence has period . Now suppose that is even. Since has order modulo , it follows that . Hence . This means that at their midpoints the two numbers and are mirror images of one another. This means that splitting midway into two equal parts and adding them gives , i.e., a string of ‘s in base . This is known as Midy’s theorem.

For example, with and we get , and . Split into two equal parts and , adding which gives

.

In general, if is any divisor of , then

so

and so splitting into equal parts and adding them will always give a multiple of .