# Detecting if a decimal is terminal or not?

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.

-

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$.
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$.