Skip to main content

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 13 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: 0.33... or more formally with a vinculum such as an overline to indicate the sequence of digits to repeat as in: 0.3―. In the case of one seventh, a sequence of digits 142857 gets repeated as in 0.142857142857... or 0.142857―. 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 r can be represented in the positional notation of an integral base b≥2 using a finite number of digits if and only if every factor of the denominator of r in its irreducible fraction is also a factor of b.

Understanding the theorem #

Let's break down this statement. If r is a rational number, it is a ratio of two integers by the definition. Thus, there exist two integers n∈Z and d∈Z such that r=nd. Furthermore, without loss of generality, we can assume nd to be the irreducible fraction (also known as the lowest form) of r meaning that n and d do not share a common factor. (If r and d did share common factors, we can keep dividing them by the common factors to arrive at the irreducible fraction.)

Now let b=∏i=1kpbiqbi=pb1qb1pb2qb2...pbkqbk where pbi∈Z is a prime number and qbi∈Z for every i be the prime factorization of b, and d=∏j=1lpdjqdj=pd1qd1pd2qd2...pdlqdl where pdj∈Z is a prime number and qdj∈Z for every j be the prime factorization of d. Then the theorem says that r is expressible using a finite number of digits in the positional notation of base b if and only if every prime number pd1,pd2,...,pdl in the prime factorization of d also appears in the prime factorization of b (i.e. if t=pdi for some i, then t=pbj for some j).

For example, one nineth is not expressible using a finite number of digits in base 10 because its irreducible fraction 19 contains 3 (since 9=32) as a prime factor in its denominator, which is not a factor of 10=2⋅5. However, 19 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, 19 is 0.01 in base 3. Similarly, 120 is expressible using a finite number of digits in base 10 because its irreducible fraction 120 only contains prime numbers which are also factors of 10 in its denominator: 20=22⋅5 Note that reducing the fraction to its irreducible form is important. As an example, 315 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 15 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 r be a rational number which can be expressed using a finite number of digits in the positional notation of an integral base b≥2. Then let dk...d2d1d0.d−1d−2...d−l be such a sequence of digits presenting r in base b where k∈N is the place of the highest digit and l∈N is the place of the lowest digit after the radix point, and di∈di∈Z|0≤di<b for all i between −l and k. Namely, r=∑i=−lkdibi=dkbk+...+d1b1+d0b0+d−1b−1+...+d−lb−l Let n=r⋅bl. Using the definition of r, n=r⋅bl=(∑i=−lkdibi)⋅bl=∑i=−lkdibi+l Substituting i with j=i+l yields: n=∑j=0k+ldj−lbj Because dj−l and bj are both integers, n is also an integer since the sum of products of integers is also an integer. Now consider the fraction nbl=r⋅blbl=r. 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 r 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 r 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 r be a rational number and r=nd with n,d∈Z be its irreducible fraction such that every factor of d is a factor of a base b≥2. Without loss of generality, assume d is non-negative (since the negative sign can always be moved from the denominator of a fraction to its numerator).

Case 1: If n is 0 or d is 1, r is an integer, and there is a representation of r using a finite number of digit in base b.

Case 2: If n is not 0 and d>1, let d=∏i=1kpiqi where k∈N, pi∈N is a prime number and qi∈N for every i be the prime factorization of d using the fundamental theorem of arithmetic. From the supposition, every prime factor (pi for every i=1...k) of d is also a factor of the base b. Let pk+1,...pl be prime factors of b which is not a factor of d if there are any, and b=∏j=1lpjrj where l∈N such that k≤l and ri∈N be the prime factorization of b.

Now let m be the maximum number amongst qi, and consider the quantity w=bmd. w=bmd=(∏j=1lpjrj)m∏i=1kpiqi=∏j=1lpjrjm∏i=1kpiqi=∏j=1lpjrjm∏i=1kpi−qi

=(∏i=1kpirim∏j=k+1lpjrjm)∏i=1kpi−qi=∏i=1kpirim−qi∏j=k+1lpjrjm

Because m≥qi and ri≥1 by the definitions of m and ri, rim≥qi and rim−qi≥0. Thus, pirim−qi is a non-negative integer for every i=1,...,k since it's a power of a prime number to a non-negative integer. Since pjrj is also a non-negative integer for all j=k+1,...,l and m is a positive integer by their definitions, the whole product w is also a non-negative integer. Then the quantity nw is also an integer since the product of two integers is also an integer.

Let nsns−1...n0 be the representation of nw in the base b. Then consider the representation of nwbm=nbmdbm=nd in base b: nsns−1...nm+1.nm...n0 with the radix point between nm and nm+1. This is the representation of nd in base b 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 nd using a finite number of digits in base b really comes down to whether we can write down 1d using a finite number of digits in base b because nd is just 1d repeated n times. If 1d is expressible using a finite number of digits in base b, there ought to be some natural (positive) number c 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 1bc represents 0 followed by c 0s and then 1. (e.g. if c=3 then 0.001.) The question boils down to whether there is such a c.

Suppose there was such a c∈N. Then 1d ought to be some multiple of 1bc. To give an example, consider a number 0.345 with c=3 in base 10. We can think of this number as 0.001 added 345 times or simply 0.001⋅345. Let t∈Z be such an integer multiple: 1d=t⋅1bc. e.g. t=345 with 1bc=1103=11000 for expressing 0.345 in base 10. Multiplying both sides of this equation by d⋅bc yields: bc=dt.

This is a crucial equation. Intuitively, this equation says that bc must be some integral multiple of the denominator d. e.g. in the case of 0.345 in base 10, bc=103=1000 must be some integral multiple of the denominator of its irreducible fraction. To see why, let's turn 0.345 into a proper fraction with integral numerators and denominators by multiplying the base number 10: 0.345=3.4510=34.5100=3451000 Now apply the prime factorization and cancel common factors to get the irreducible fraction: 0.345=3451000=3⋅5⋅2323⋅53=3⋅2323⋅52=69200 Sure enough, 1000=5⋅200. Notice that t=5 in this case is simply a common factor we originally had. In fact, t 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 bc=dt, we see that bc must have all prime factors of d and t because bc and dt are identical. But this would implies that every prime factor of d must be a prime factor of b since raising b to the power of c does not introduce a new prime factor, and multiplying d with any integer, in particular by t, does not eliminate a prime factor in d.