Take the 2-minute tour ×
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.

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|improve this question
add comment

2 Answers

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|improve this answer
    
Thanks! Exactly what I was looking for! –  SuprDewd Jan 9 '11 at 16:24
add comment

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|improve this answer
add comment

Your Answer

 
discard

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.