Midy's theorem, named after French mathematician E. Midy, is a statement about the decimal expansion of fractions a/p where p is a prime and a/p has a repeating decimal expansion with an even period (sequence A028416 in the OEIS). If the period of the decimal representation of a/p is 2n, so that
a p = 0. a 1 a 2 a 3 … a n a n + 1 … a 2 n
then the digits in the second half of the repeating decimal period are the 9s complement of the corresponding digits in its first half.