A Rational Number With a Finite Number of Digits
A rational number, by its definition, is a ratio of two integers. Yet, some of them are not expressible using a finite number of digits in decimals, or more formally known as base-ten positional notation. For example, the number one third can be written exactly as as a fraction, yet we cannot express the same number using a finite number of digits in base 10. The best we can do is to imply the indefinite repeating of the digit 3 using elipsis as in: or more formally with a vinculum such as an overline to indicate the sequence of digits to repeat as in: . In the case of one seventh, a sequence of digits gets repeated as in or . When I was a kid and first learned of division, I was very fascinated by this phenomnea. Today, I present an answer to one of the questions I once had as a kid: when can a rational number be expressed using a finite number of digits?
Theorem
A rational number can be represented in the positional notation of an integral base using a finite number of digits if and only if every factor of the denominator of in its irreducible fraction is also a factor of .
Understanding the theorem
Let’s break down this statement. If is a rational number, it is a ratio of two integers by the definition. Thus, there exist two integers and such that . Furthermore, without loss of generality, we can assume to be the irreducible fraction (also known as the lowest form) of meaning that and do not share a common factor. (If and did share common factors, we can keep dividing them by the common factors to arrive at the irreducible fraction.)
Now let where is a prime number and for every be the prime factorization of , and where is a prime number and for every be the prime factorization of . Then the theorem says that is expressible using a finite number of digits in the positional notation of base if and only if every prime number in the prime factorization of also appears in the prime factorization of (i.e. if for some , then for some ).
For example, one nineth is not expressible using a finite number of digits in base 10 because its irreducible fraction contains 3 (since ) as a prime factor in its denominator, which is not a factor of . However, is expressible using a finite number of digits in base 3 notation since the denominator only contains the prime factor of 3, which is also a factor of the base. Namely, is 0.01 in base 3. Similarly, is expressible using a finite number of digits in base 10 because its irreducible fraction only contains prime numbers which are also factors of 10 in its denominator: Note that reducing the fraction to its irreducible form is important. As an example, is expressible using a finite number of digits in base 10 even though its denominator contains a prime factor of 3, which is not a factor of 10 since its irreducible form only contains the prime factor of 5, which is a factor of 10.
Proof
If a rational number can be represented using a finite number of digits in a base, then a prime factor of the denominator of its irreducible fraction is a factor of the base
Let be a rational number which can be expressed using a finite number of digits in the positional notation of an integral base . Then let be such a sequence of digits presenting in base where is the place of the highest digit and is the place of the lowest digit after the radix point, and for all between and . Namely, Let . Using the definition of , Substituting with yields: Because and are both integers, is also an integer since the sum of products of integers is also an integer. Now consider the fraction . The denominator only contains the prime factors of b since it’s a power of b. Because reducing this fraction by canceling common factors in the numerator and the denominator does not introduce a new prime factor in the denominator, the irreducible fraction of must also not have a prime factor which is not a factor of b in its denominator. That is, every prime factor of the denominator of the irreducible fraction of is also a factor of b as desired.
If every prime factor of the denominator of a rational number in its irreducible fraction is also a factor of a base, then the number can be represented using a finite number of digits in the base.
Let be a rational number and with be its irreducible fraction such that every factor of is a factor of a base . Without loss of generality, assume is non-negative (since the negative sign can always be moved from the denominator of a fraction to its numerator).
Case 1: If is 0 or is 1, is an integer, and there is a representation of using a finite number of digit in base .
Case 2: If is not 0 and , let where , is a prime number and for every be the prime factorization of using the fundamental theorem of arithmetic. From the supposition, every prime factor ( for every ) of is also a factor of the base . Let be prime factors of b which is not a factor of if there are any, and where such that and be the prime factorization of .
Now let be the maximum number amongst , and consider the quantity . Because and by the definitions of and , and . Thus, is a non-negative integer for every since it’s a power of a prime number to a non-negative integer. Since is also a non-negative integer for all and is a positive integer by their definitions, the whole product is also a non-negative integer. Then the quantity is also an integer since the product of two integers is also an integer.
Let be the representation of in the base . Then consider the representation of in base : with the radix point between and . This is the representation of in base using a finite number of digits as desired.
Q.E.D.
Intuitive Reasoning
The second half of the proof gives us an intuition as to why this theorem holds. The question of whether we can write down using a finite number of digits in base really comes down to whether we can write down using a finite number of digits in base because is just repeated times. If is expressible using a finite number of digits in base , there ought to be some natural (positive) number such that c-th digit after the radix point is the last digit. That is, since it’s finite, there must be the last digit. The quantity represents 0 followed by 0s and then 1. (e.g. if then .) The question boils down to whether there is such a .
Suppose there was such a . Then ought to be some multiple of . To give an example, consider a number with in base 10. We can think of this number as added times or simply . Let be such an integer multiple: . e.g. with for expressing in base 10. Multiplying both sides of this equation by yields: .
This is a crucial equation. Intuitively, this equation says that must be some integral multiple of the denominator . e.g. in the case of in base 10, must be some integral multiple of the denominator of its irreducible fraction. To see why, let’s turn into a proper fraction with integral numerators and denominators by multiplying the base number 10: Now apply the prime factorization and cancel common factors to get the irreducible fraction: Sure enough, . Notice that in this case is simply a common factor we originally had. In fact, can be thought of as common factors needed in numerators and denominators to make the denominator become a power of 10.
Now, going back to , we see that must have all prime factors of and because and are identical. But this would implies that every prime factor of must be a prime factor of since raising to the power of does not introduce a new prime factor, and multiplying with any integer, in particular by , does not eliminate a prime factor in .