Double limit of $\cos^{2n}(m! \pi x)$ at rationals and irrationals I stumbled upon this "relation" (is the name correct?):
$$
\lim_{m \to \infty} \lim_{n \to \infty} \cos^{2n}(m! \pi x) = \begin{cases}
1,&x\text{ is rational}\\
0,&x\text{ is irrational}\end{cases}
$$
How is it called and why is it so? I'm really not asking for a proof since I fear it would be too complicated for me to understand, but rather for an "intuition".

This is known as Dirichlet Function,
If $m!x$ is an integer, then $\cos^{2n}(m!\pi x) = 1$.
If $x$ is rational $\frac{p}{q}$, then, eventually, for large enough $m$, $m!$ will be divisible by $q$ (and stay so for all larger m), so that $m!x$ will be an integer, and we have what we want.
If $x$ is irrational, $m!x$ will never be an integer, and $|\cos(m!\pi x)| \lt 1$, so that $\lim_{n \to \infty} \cos^{2n}(m!\pi x) = 0 $ for all $m>0$.
