In base , the numbers which "terminate" are of the form for some .

A necessary and sufficient condition for a rational , where are relatively prime, to "terminate" in base is therefore that the prime divisors of are prime divisors of . (which is equivalent to saying that divides for some )

For instance, in base 10, "terminates" iff the only prime divisors of are 2 and 5 (supposing again that ). In base 2, has to be even.

I hope I was clear. If not, just ask.

Laurent.