The $64,000 question . It was my Dad who first exposed me to the concept of expressing fractions by their decimal equivalents. Then, when I understood this connection, I set about creating lists of fractions and decimals, and I began to notice some of their properties.
One evening, I made the observation that the digits in one half of the period of a certain decimal (probably for 1/7) complemented the digits in the other half; and so I came to think of this characteristic as "9s complement." (1/7 = .142857, repeated; and 142 + 857 = 999.)
If a fraction has a prime denominator (other than 2 or 5, which are factors of 10), its decimal expansion will be periodic, meaning that it will consist of a group of digits (the period) that repeats infinitely. In mathematical notation, this is typically indicated by the placement of a bar (called a "vinculum") over the period; however, as I can't do that with HTML, I'll use the notation I adopted for myself early on, which is to place a lower-case "r" in front of the period. For instance, 1/3 = .r3, since the decimal expansion is .333333333.... Likewise, I would represent 1/11 as .r09, since the expansion is .0909090909...
If the period of a fraction has an even number of digits, it will exhibit the 9s complement trait; otherwise, not. What follows is my attempt to explain why.
The Period of a Decimal Expansion
Given any integer d as the denominator of a fraction, there are (d - 1) possible numerators, ranging from 1 to (d - 1), with each producing a different decimal. For example, 3 has 1/3 (.r3) and 2/3 (.r6); 5 has 1/5 (.2), 2/5 (.4), 3/5 (.6), and 4/5 (.8); and 7 has 1/7 (.r142857), 2/7 (.r285714), 3/7 (.r428571), 4/7 (.r571428), 5/7 (.r714285), and 6/7 (.r857142).
Notice something about the 7ths: the periods all use the same cycle of six digits: 142857. The order in which the digits occur never changes; only the digit with which the cycle begins varies as the numerator changes. Now, consider the 13ths: 1/13 = .r076923, 2/13 = .r153846, 3/13 = .r230769, 4/13 = .r307692, 5/13 = .r384615, 6/13 = .r461538, 7/13 = .r538461, 8/13 = .r615384, 9/13 = .r692307, 10/13 = .r769230, 11/13 = .r846153, and 12/13 = .r923076.
With the 13ths, there are 12 numerators, but instead of one cycle of 12 digits for all 12 decimal expansions, there are two cycles of six digits each: 076923 (for numerators 1, 3, 4, 9, 10, and 12) and 153846 (for 2, 5, 6, 7, 8, and 11).
Given a fraction of a prime number p, the length of the period will always be either (p - 1) or a factor of (p - 1); and all decimal expansions of n/p will have the same length period. With the 7ths, the period length is 6; with the 13ths, the period length is 6, a factor of 12. The mathematical term for a prime number whose reciprocal is a period of (p - 1) digits is a "full reptend prime."
While many periods do have an even number of digits, there are also many with an odd number. The first fraction with an odd period length is, of course 1/3. The next happens to be 1/31, with a period length of 15 (.r032258064516129). Obviously, since the period has an odd number of digits, one can't split it into two equal parts which will add up to a number consisting of all 9's.
But what about the even period lengths? With the 7ths and 13ths, it can be easily seen that the periods can be split and that the two halves add up to 999: 142 + 857 (7ths), 076 + 923 (13ths, first cycle), 153 + 846 (13ths, second cycle).
Because the decimal expansion of all fractions with prime denominators (excepting 2 and 5) is periodic, it follows that the calculation of each must return us at some point to a remainder that is the same as the original numerator. So with 1/7, the process goes like this: 1 / 7 = 0 remainder 1; 10 / 7 is 1 remainder 3; 30 / 7 is 4 remainder 2; 20 / 7 is 2 remainder 6; 60 / 7 is 8 remainder 4; 40 / 7 is 5 remainder 5; and 50 / 7 is 7 remainder 1, which returns us to the starting point.
From this, it can be seen that every prime number p (save 2 and 5) divides some number 10^n - 1, where n is either (p - 1) or a factor of (p - 1).