Extended Midy’s Theorem

Bassam Abdul-Baki July 12, 2005

Theorem (Original) If the period of a repeating decimal for a/p, where p is prime and a/p is a reduced fraction, has an even number of digits, then dividing the repeating portion into halves and adding gives a string of 9s. For example, 1/7 = 0.\overline{142857}, and 142 + 857 = 999. Theorem (Extended) If the period of a repeating decimal for a/p, where p is prime and a/p is a reduced fraction, is h = m × n, then dividing the repeating portion into n parts and adding gives c_{n}(a, p) × 9 m’s, where c is a constant depending on p, a and n. Proof We will show some interesting properties for various types of primes p. Let a/p have period h > 1 with a < p, and assume a/p = 0.\overline{a_{1} … a_{m×n}}. Thus, p ≠ 2, 5. Then, 10^{i} × a/p − ⌊10^{i} × a/p⌋ = 0.\overline{a_{i+1} … a_{m×n}a_{1} … a_{i}} < 1, since a < p. Thus, p × (10^{i} × a/p − ⌊10^{i} × a/p⌋) = p × 0.\overline{a_{i+1} … a_{m×n}a_{1} … a_{i}} < p ⇒ 10^{i} × a−⌊10^{i} × a/p⌋×p = a×10^{i} (mod p), ∀a, i ∋ 0 ≤ i ≤ m×n−1, 1 ≤ a ≤ p−1. And, {a × 10^{i} − ⌊10^{i} × a/p⌋ × p, ∀i ∋ 0 ≤ i ≤ m × n − 1} = {a, a × 10, a × 10^{2}, …, a × 10^{m×n−1}} (mod p) ⊆ {1, …, p − 1}. And hence, there exists \frac{p−1}{h} distinct cyclic generators (\{e = e_{1}, e_{2}, …, e_{\frac{p−1}{h}} \})

such that ⋃_{i=1}^{\frac{p−1}{h}}\{e_{i}, e_{i}^{2}, …, e_{i}^{m×n−1}\} = \{1, …, p − 1\}.

Let

S_{n} = ∑_{i=0}^{n−1} 0.\overline{a_{m×i+1} … a_{m×n}a_{1} … a_{m×i}}
= ∑_{i=0}^{n−1} 0.\overline{a_{m×i+1} … a_{m×(i+1)}}
= ∑_{i=0}^{n−1} a_{m×i+1} … a_{m×(i+1)}/(10^{m} − 1)

Example: 0.\overline{142857} + 0.\overline{571428} + 0.\overline{285714} = 0.\overline{141414} + 0.\overline{282828} + 0.\overline{575757} = 14/99 + 28/99 + 57/99.

Thus,

p × S_{n} = p × ∑_{i=0}^{n−1} 0.\overline{a_{m×i+1} … a_{m×n}a_{1} … a_{m×i}}
= ∑_{i=0}^{n−1}((a × 10^{m×i})(modp))
= p × ∑_{i=0}^{n−1} a_{m×i+1} … a_{m×(i+1)}/(10^{m} − 1)

Thus, c_{n}(a, p) = ∑_{i=0}^{n−1} a_{m×i+1} … a_{m×(i+1)} = \frac{10^{m} − 1}{p} × ∑_{i=0}^{n−1}((a × 10^{m×i}) (mod

p)).

Example: 1/17 = 0.\overline{0588235294117647}, and

m n c_{n}
{0+5+8+8+2+3+5+2+9+4+1+1+7+6+4+7 = 72 ≡ 0 \atop (mod 9)} 1 16 8
{05 + 88 + 23 + 52 + 94 + 11 + 76 + 47 = 396 ≡ 0 (mod \atop 99)} 2 8 4
0588 + 2352 + 9411 + 7647 = 19998 ≡ 0 (mod 9999)  4 4 2
05882352 + 94117647 = 99999999 ≡ 0 (mod 99999999) 8 2 1

1/19 = 0.\overline{052631578947368421}, and

m n c_{n}
{0+5+2+6+3+1+5+7+8+9+4+7+3+6+8+4+2+1 = \atop 81 ≡ 0 (mod 9)} 1 18 9
{05 + 26 + 31 + 57 + 89 + 47 + 36 + 84 + 21 = 396 ≡ 0 \atop (mod 99)} 2 9 4
052 + 631 + 578 + 947 + 368 + 421 = 2997 ≡ 0 (mod 999) 3 6 3
052631 + 578947 + 368421 = 999999 ≡ 0 (mod 999999) 6 3 1
{052631578 + 947368421 = 999999999 ≡ 0 (mod \atop 999999999)} 9 2 1

1/757 = 0.\overline{001321003963011889035667107}, and

m n c_{n}
0 + 0 + 1 + 3 + 2 + 1 + 0 + 0 + 3 + 9 + 6 + 3 + 0 + 1 + 1 + ; 8 + 8 + 9 + 0 + 3 + 5 + 6 + 6 + 7 + 1 + 0 + 7 = 90 ≡ 0 ; (mod 9) 1 27 10
{001 + 321 + 003 + 963 + 011 + 889 + 035 + 667 + 107 = \atop 2997 ≡ 0 (mod 99)} 3 9 3
{001321003 + 963011889 + 035667107 = 999999999 ≡ 0 \atop (mod 999)} 9 3 1

Trivia: The decimal expansion of 1/19 is equal to the sum of the powers of 2 in reverse. 1/19 = 0.\overline{052631578947368421} Compare it to 1/49. Summary Assuming n | h, where 10^{h} ≡ 1 (mod p) and 1 ≤ a ≤ p − 1. If p = 3, then c_{n}(a, 3) = a × n/3. If n = 1, then c_{1}(a, p) = 1/p. If n = 2, then c_{n}(a, p) × p < (p − 1) + (p − 2) = 2 × p − 3 < 2 × p. Thus, c_{2}(a, p) = 1 (Midy’s Theorem). If n = 3 and a = 1, then c_{n}(1, p)×p < 1+(p−2)+(p−3) = 2×p−2 < 2×p. Thus, c_{3}(1, p) = c_{3}(2, p) = c_{3}(3, p) = c_{3}(4, p) = 1. However, these may not be unique. If n = p − 1, then c_{n}(a, p) × p = ∑_{i=1}^{p−1} i. Thus, c_{p−1}(a, p) = \frac{p−1}{2} (Full Reptend Prime). If we replaced p with any number b ≠ {2, 5}, then adding the n equal partitions of the repeating decimal of a/b is also equal to c_{n}(a, b) × 9 m’s, where c_{n}(a, b) is a rational number. Open Questions

1. c_{n}(1, p) = ⌊\frac{c_{h}(1,p)}{h/n}⌋, ∀ n | h.

When p is a full reptend prime, c_{n}(a, p) = c_{n}(1, p), ∀ a ≠ 1.

2. If 2 | h, then h/2 ≤ c_{h}(a, p) ≤ C, where C = \{sup x ∋ ⌊\frac{x}{h/2}⌋ = 1\}.

If 3 | h, then h/3 ≤ c_{h}(a, p) ≤ C, where C = \{sup x ∋ ⌊\frac{x}{h/3}⌋ = 1\}. If 6 | h, then h/2 ≤ c_{h}(a, p) ≤ C, where C = \{sup x ∋ ⌊\frac{x}{h/3}⌋ = 1\}. Examples: 9 ≤ c_{27}(a, 757) ≤ 17, 9 ≤ c_{18}(a, 19) ≤ 11 and 3 ≤ c_{6}(a, 7) ≤ 3.

3. c_{n}(1, p) ≤ c_{n}(a, p), ∀ 1 < a < p.

This is equivalent to ∑_{i=0}^{n−1}(10^{m×i} (mod p)) ≤ ∑_{i=0}^{n−1}((a × 10^{m×i}) (mod p)).

References

1. Eric W. Weisstein. ”Midy’s Theorem.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/MidysTheorem.html

2. Eric W. Weisstein. ”Full Reptend Prime.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/FullReptendPrime.html