An integer is a $n$'th power if that holds true for all moduli.
Am I mistaken, or does the following (actually) elementary proof work?
To show that $x$ is a perfect $n$th power, it suffices to show that for all primes $p$, the number of times that $p$ divides into $x$ is a multiple of $n$.
To that end, fix any prime $p$, and let $r_p$ be the largest integer such that $p^{r_p}$ divides $x$. Consider $k=p^{r_p+1}$. Then, since $k$ divides $a_k^n -x$, $p^{r_p}$ divides $a_k^n$.
Moreover, it cannot be that $k = p^{r_p + 1}$ divides $a_k^n$. If it were so, then since $p^{r_p + 1}$ divides $a_k^n - x$, $p^{r_p + 1}$ would divide $x$, which contradicts the maximality of $r_p$.
Therefore, $p^{r_p}$ divides $a_k^n$ but $p^{r_p + 1}$ does not; it follows that $r_p$ is equal to the number of times $p$ divides into $a_k^n$, which must be a multiple of $n$ (consider the prime factorization of $a_k^n$), so we are done.
This is an old chestnut: an integer which is an $n$-th power modulo all primes is an $n$-th power.
There is a sledgehammer proof via the Chebotarev density theorem. Suppose for the moment that $n$ is prime. Consider $K=\mathbb{Q}(x^{1/n})$ and its Galois closure $L=\mathbb{Q}(x^{1/n},\exp(2\pi i/n))$. Then each prime $p$ that is unramified in $L$ splits in $K$ into various prime ideals at least one of which has norm $p$. So its Frobenius has a fixed point on the permutation representation on the $n$-th roots of $x$. By Chebotarev, the Galois group $G$ of $L/\mathbb{Q}$ has no element of degree $n$ and so must have a fixed point; that is one of the $n$-th roots of $x$ must lie in $\mathbb{Q}$.
I'm sure something similar works for any positive integer $n$, but it's too late tonight for me to work out the details :-)
I discovered this question 6 years later. Worth emphasis: there is a much simpler proof, namely choose $\,k^{\phantom{|^{|^|}}}\!\!\!=x^2\Rightarrow\,x^2\mid x-a^n\Rightarrow\, x\mid a^n\,$ so $\ \color{#c00}{ a^n\! = mx}\ $ so ${\ jx^2\! = x-\!\overbrace{mx}^{\large\ a^n}}^{\phantom{|}} $ for some $\,j,m\in\Bbb Z.\,$ Note $\,m = 1\!-\!jx\,$ is coprime to $\,x\,$ so, like $\,\color{#c00}{a^n}\,$ both $\color{#c00}{m\ \&\ x}^{\phantom{|^{|^|}}}\!\!\!\!\ $ must be $\,n$'th powers too.