1

I was doing some exercises about conversion of numerical representation between base 10 and base 2. In particular, i was solving the exercise: $(3.1416)_{10} $ to base 2. I solved about sixteen interactions over the fractional part and i wasn't expecting it to end very soon (actually i was hoping for some period to show).

So my question is: is there any criteria to decide when the numerical representation will be finite?

user2345678
  • 2,885

4 Answers4

1

Yes. The real number $x$ can be written in base $2$ with a finite number of digits if and only if $x$ is rational and its denominator (written in smallest term) is a power of two.

For a proof, note that dividing by $2^n$ is base $2$ can be done by moving the point rightwards $n$ places, and conversely, if $x$ has $n$ digits then $2^nx$ is an integer.

ajotatxe
  • 65,084
1

The base $b$ representation of $x$ is finite if and only if $b^d x$ is an integer for some $d$. If you write $x$ as a rational number of the form $m/n$ (in lowest terms), what you need is that with $n$ divides some power of $b$.

Equivalently, every prime dividing $n$ also divides $b$. If $b = 2$, the only prime allowed is $2$: $n$ must be a power of $2$.

Now if the decimal representation of $x$ is $A.B$, i.e. the fractional part of $x$ is $B/10^d$ where $B$ consists of $d$ digits, this is equivalent to $B$ being divisible by $5^d$.

Robert Israel
  • 448,999
0

A rational number written as $\frac pq$ in lowest terms, has a finite binary representation if and only if $q$ is a power of $2$.

How this works out if your original number is a decimal fraction is:

  • If the decimal representation does not end, then neither does the binary one.

  • If the decimal representation does end, then take all the digits after the decimal point and check whether the number they make up is divisible by $5^n$, where $n$ is the number of digits. The binary representation is finite exactly if $5^n$ divides the digits.

For example $1416$ is not divisible by $5^4$, so $3.1416$ does not have a finite binary fraction representation.

On the other hand $123.625$ has a finite binary fraction because $625$ is divisible by $5^3=125$.


Oh, and by the way, the period of the binary representation of $3.1416$ is exactly $500$ bits long. (Found in the boring way by writing program to do the long division $1416\div10000$ in base $2$ and check when the remainder repeated).

0

To check if numerical representation of number

$r= (3.1416)_{10} $

is finite one needs only fractional part of the number

$frac((3.1416)_{10}) = (0.1416)_{10} = \frac{1416}{10000}$

First convert the fraction to lowest terms ( irreducible)

$\frac{1416}{10000} = \frac{117}{1250}$

then check the prime factors of denominator:

$1250 = 2*5^4 = 2^1*5^4 = 2^t*q$

so

  • preperiod t = 1
  • period = $\phi(q) = \phi(5^4) = 500$

One can check it online:

$0.0(00101111111011000101011011010101110011111010101011001101100111101000001111100100001001011010111011100110001100011111100010100000100100000010110111100000000011010001101101110001011101011000111000100001100101100101001010111101001111000011011000010001001101000000010011101010010010101000110000010101010011001001100001011111000001101111011010010100010001100111001110000001110101111101101111110100100001111111110010111001001000111010001010011100011101111001101001101011010100001011000011110010011110111011)$

Adam
  • 1,716