Converting Decimal with 3 decimal places to Octal

223 Views Asked by At

I know how to convert from $769_{10}$ to base 8 that is $1401_8$ through dividing and remainder method but what is the method for $769.513_{10}$ to convert to octal?I know that it is to separate the integer part and the decimal place part that is $1401_8$ $\bullet$ (answer from converting $0.513_{10}$ to octal).I just can't seem to work out the $0.513_{10}$ part to octal.

3

There are 3 best solutions below

0
On

First of all, note that $\lfloor8\times.513\rfloor=4$; that will your first digit.

On the other hand, $.513-4\times8^{-1}=.513-.5=.013$. And $\lfloor8^2\times.013\rfloor=0$: that will be your second digit.

Now, $\lfloor8^3\times.013\rfloor=6$. So, your third digit will be $6$. And so on…

Actually, this process will never stop, since $.513=\dfrac{513}{1\,000}$ and this fraction is irreducible. In particular, it is not of the type $\dfrac a{8^b}$, with $a\in\mathbb Z$ and $b\in\mathbb{Z}_+$.

0
On

Hint:

$$.513=\dfrac{513}{1000}=\dfrac{a_1}8+\dfrac{a_2}{8^2}+\cdots$$ where $0\le a_i\le7$

$$\implies513=125a_1+\cdots$$

$\implies a_1=\left\lfloor\dfrac{513}{125}\right\rfloor=?$

$513-500=\dfrac{1000a_2}{8^2}+\dfrac{1000a_3}{8^3}+\cdots$

$\implies a_1=\left\lfloor\dfrac{(513-500)8^2}{1000}\right\rfloor=?$

Can you take it from here?

0
On

So the question is to write $$ x=0.513=0.513_{(10)}=\frac{513}{1000} $$ to octal. (If no base is written, numbers are considered in the usual decimal system. So $0.513$ is decimal, same for the numerator $513$, and denominator $1000$, decimal numbers.)

It is known that the result is a periodic number, there may be a part after the comma place which is "atypical", but then we repeat the period. First, $$ \frac 1{1000}=\frac 18\cdot\frac 1{125}\ . $$ We have $\frac {513}{125}=4+\frac{13}{125}$. It will be enough to get the octal representation of $13/125$.

We now search for a number of the shape $8^k-1$ which is divisible by $125$. We know (Euler, Euler indicator function) that $k=\phi(125)=100$ does it, but it is a good idea to get the minimal $k$. Well, as it happens here, it is $100$. So we expect a period of this length! It is natural that i will use a computer to get it. Now $$ \begin{aligned} \frac 1{125} &= \frac{(8^{100}-1)/125}{8^{100}-1} = N\cdot\frac{1}{8^{100}-1}\text{ with }N=(8^{100}-1)/125\in\Bbb N\ , \\ &= N\cdot\frac{1}{8^{100}}\cdot\frac{1}{1-\left(\frac 18\right)^{100}} \\ &= N\cdot q\cdot\frac{1}{1-q}\text{ with } q=\left(\frac 18\right)^{100}\ , \\ &= N(q+q^2+q^3+q^4+\dots)\ . \end{aligned} $$ The last number is simple, as follows: $q$ is the octal number $0,000\dots1$, then $q^2$ is $0,000\dots0\ 000\dots1\ $, and so on, the sum $q+q^2+\dots$ is the periodic number $0.(000\dots1)$, where the parenthesis means "period". An then we multiply by $N$, thus $N$ "becomes the period", well, adjusted to $100$ digits as a "p hone number". In our case, we need instead $13/125$, so we use $13\cdot N$. This is using sage

sage: 13*(8^100-1)/125
211851741538786552971918351594575328749352712941257370066158606732855655175387017443073327

in a decimal writing. Octal representation of it, again using sage:

sage: ''.join( [ str(digit) for digit in ZZ(13*(8^100-1)/125).digits(base=8)[::-1] ] )
'651767635544264162540203044672274324773716662132071260101422335136152375747331055034530040611156457'

So the final answer is $$ \begin{aligned} 0.513 & =\frac 18\cdot\frac {513}{125} =\frac 18\cdot\left(4+\frac {13}{125}\right) \\ &= \frac 18\cdot (4_{(8)}+ 0.(065176763554426416254020304467227432 \\&\qquad\qquad 477371666213207126010142233513615237574 \\&\qquad\qquad\qquad 7331055034530040611156457)_{(8)} ) \\ &= \frac 18\cdot 4.(065176763554426416254020304467227432 \\&\qquad\qquad 477371666213207126010142233513615237574 \\&\qquad\qquad\qquad 7331055034530040611156457)_{(8)} \\ &= 0.4(0651767635544264162540203044672274 \\&\qquad\qquad 32477371666213207126010142233513615237 \\&\qquad\qquad\qquad 5747331055034530040611156457)_{(8)} \end{aligned} $$ A small check for the first octal places after the comma:

sage: a - 4/8 - 6/8^3 - 5/8^4 - 1/8^5 - 7/8^6 - 6/8^7
61/131072000
sage: _ < 1/8^7
True