Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If $x$ is prime and $1000000000000 < x < 1000100000000$,
how can I detect if $1 / x$ will result in a terminal decimal or not?
I can use programming.

share|cite|improve this question
up vote 7 down vote accepted

Suppose that $p$ is a prime other than $2$ or $5$. Then if $\frac{1}{p}$ was a terminating decimal, we would have that $\frac{10^n}{p} = a$ for some $n,a \in \mathbb{N}$. But this is a contradiction since $p$ clearly doesn't divide $10^n$.

Hence $\frac{1}{p}$ is not a terminating decimal for any prime $p$ other than $2$ or $5$.

share|cite|improve this answer
Thanks! Exactly what I was looking for! – SuprDewd Jan 9 '11 at 16:24

If "terminal" means the decimal expansion is eventually zero, then no such number has a terminal expansion. $1/x$ has a terminal expansion iff $x=2^a 5^b$ for some $a$, $b$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.