How to check quickly $\frac{2}{3}=.101010... $ holds?

152 Views Asked by At

Every $x \in [0, 1]$ can be expressed in the form $\dfrac{a_1}{2}+\dfrac{a_2}{2^2}+\dots + \dfrac{a_m}{2^m}+\dots$ , where each $a_i$ equals either $0$ or $1$. For such $x$, we have the binary expansion $x = .a_1a_2 . . . a_m . . .$ .

How can I calculate say $\frac{2}{3}$ quickly in binary expansion form without calculating a_i's one by one manually. I need it for the topic of dynamical system and I don't know some method or available relevant calculator for that.

According to the book, $\frac{4}{5}=.11001100... $ and $\frac{2}{5}=.011001100... $ and $\frac{2}{3}=.101010... $; how to check them quickly?

Thank you.

2

There are 2 best solutions below

0
On
Take the example of ⅔ = 0.1010101010... 
divide by 2:          = 0.0101010101...
add them up         1 = 0.1111111111 ...
So even if we had no idea that the binary, call it b, was ⅔ 
initially we would know now that b + b/2 =1 and so b=⅔

For ⅖               b = 0.011001100110 ...
                  2b  = 0.110011001100 ...
                  b/2 = 0.001100110011 ...
          and so 5b/2 = 0.111111111111 ...
                 so b = ⅖
For things like b= 0.0111011101110... where adding would get messier,
note that 111 = 7, so divide by 7 first:
                    b  = 0.0111011101110 ...
                   b/7 = 0.0001000100010 ...
multiply by 15   15b/7 = 0.1111111111111 ...  
                     b = 7/15   
0
On

Checking is easy: If $$x=0.{\bf q}{\bf p}{\bf p}{\bf p}{\bf p}\ldots\ ,\tag{1}$$ where the preperiod ${\bf q}$ and the period ${\bf p}$ are binary strings of length $r$ and $s$, respectively, then $$2^rx={\bf q}.{\bf p}{\bf p}{\bf p}{\bf p}\ldots$$ and consequently $$(2^r-1)x={\bf q}.{\bf p}-0.{\bf q}\ .$$ It follows that $$x={{\bf q}.{\bf p}-0.{\bf q}\over 2^r-1}\ .$$ But grinding out the binary expansion $(1)$ for a given rational number $x={m\over n}$ has to be done "by hand", i.e. using the well known division algorithm from primary school, which can take up to $n-1$ steps. Note that the decimal period of ${1\over7}=0.142857\ldots$ has length $6$.