Is there an algorithm or method to tell if a fraction can be represented exactly in a particular base? For instance, 1/3 cannot be represented exactly in base 10, but in many other bases it can.
Is there an algorithm that will tell you, given x,y,z, where x and y form a ratio of integers (a fraction) and z is the base, whether it can be represented exactly or must be approximated?
I feel like this is a stupid question and there's some really obvious way to tell that I'm not thinking of.
 A: There is an easy algorithm. Assuming $x,y$ coprime, the fraction $\dfrac{x}{y}$ has a terminating representation in base $z$ if and only if all prime divisors of $y$ are also prime divisors of $z$, or, equivalently, if $y$ divides some power of $z$.
Since integers are unproblematic, we can assume that $0 < x < y$.
If $\dfrac{x}{y}$ has a terminating representation in base $z$, then that representation is
$$\frac{x}{y} = \sum_{k=1}^n \frac{d_k}{z^k},$$
where every digit is an integer $0 \leqslant d_k \leqslant z-1$. Then we have
$$z^n\cdot \frac{x}{y} = \sum_{k=1}^n d_k\cdot z^{n-k} =: r \in \mathbb{N},$$
and
$$\frac{x}{y} = \frac{r}{z^n}.$$
Since the fraction $\dfrac{x}{y}$ was assumed reduced, the above equality implies $z^n = k\cdot y$ and $r = k\cdot x$ for some $k \in \mathbb{N}$, so $y$ divides a power of $z$, hence has no prime factors that don't divide $z$.
Conversely, if $y$ is a divisor of a power of $z$, say $z^n = m\cdot y$ for some $m \in \mathbb{N}$, then
$$\frac{x}{y} = \frac{m\cdot x}{m\cdot y} = \frac{m\cdot x}{z^n}.$$
Let the integer $r = m\cdot x$ have the base-$z$ expansion
$$r = \sum_{k=0}^q d_k\cdot z^k.$$
Then we have
$$\frac{x}{y} = \frac{r}{z^n} = \sum_{k=0}^q d_k z^{k-n} = \sum_{j = n-q}^{n} \frac{d_{n-j}}{z^j},$$
a terminating representation of $\dfrac{x}{y}$.
