1
$\begingroup$

Say I have a number $x \in \mathbb{Q}$ which possibly cannot be writen exactly in decimal form, but at least $x \notin \mathbb{Z}$ ($x$ is not an integer).

How do I calculate the first $n$ digits of this number $x$, for a given $n$? Also, how do I know if it has a finite or infinite amount of (nonzero) digits in decimal form?

For example, if $x = \frac{1000}{1001}$, how do I calculate the first $n = 10$ digits of this number?

I know this question sounds really basic, but since it is basically always done by means of a calculator or other computing device, I've never really done it before.

$\endgroup$
2
  • 2
    $\begingroup$ Early school long division, or am I misunderstanding your question? Incidentally, this reminds me of Isaac Asimov's short story The feeling of power. $\endgroup$ Sep 28, 2016 at 20:56
  • 1
    $\begingroup$ Unfortunately , long division is out of fashion in many schools these days. A pity... $\endgroup$ Sep 28, 2016 at 20:59

2 Answers 2

4
$\begingroup$

A simple algorithm is the following :

Take integer part $\rightarrow$ multiply the numerator of the remainder by $10$ (in base $10$) $\rightarrow$ divide by the denominator $\rightarrow$ repeat

Each integer part obtained is one digit.

Once you decide you have enough digits, use common sense to place the dot.

Example :

For $\frac{1000}{1001}$

The integer part is $0$ so the first digit is $0$

The remainder is $\frac{1000}{1001}$

We multiply the numerator by $10$ : $1000\times10=10000$

We divide by the denominator $1001$ and take the integer part : $9$

So the second digit is $9$.

The numerator of the remainder is $10000-9\times1001=991$

Multiply it by $10$ and get $9910$

Divide by $1001$, take the integer part : $9$, which is our third digit...

etc.

So the first three digits are $0.99$

I let you compute the other ones !

(It is basically long division, but it was so badly taught to me I didn't even understand I could just work that way without drawings or fluff, and it seems much easier now, especially for mental maths.)

$\endgroup$
1
  • $\begingroup$ Yes, what you are describing is a way of presenting the classical long division algorithm. However at the point where you say "divide by the denominator" you are suppressing an important detail: at that point you know the result of that division is less than 10 but finding the quotient digit has to be done by trial and error. $\endgroup$
    – Rob Arthan
    Sep 28, 2016 at 21:26
2
$\begingroup$

To find if it has a terminating decimal, so has a finite number of nonzero digits, check if the denominator factors as $2^a5^b$. If the denominator has any prime factors other than $2$ or $5$, the decimal will repeat infinitely. The termination will come at $\max (a,b)$ because the denominator will divide evenly into $10^{\max(a,b)}$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .