Show this function can be defined as the limit function Let f: $ \mathbb{R} \rightarrow \mathbb{R} $ be defined by f(x) = 1 for x $\in \mathbb{Q} $, f(x) = 0 otherwise. We can see f is not regulated. Show that f may be obtained as a limit function: f(x) = $lim_{m\rightarrow ∞}$, where $f_m: \mathbb{R} \rightarrow \mathbb{R} $ is defined by $f_m(x)$ = $lim_{n\rightarrow∞}(cos(m!\pi x))^{2n}$.
We are also given the hint that f(x) = 0 unless $cos(m!\pi x) \in \{-1,1\}$ i.e. x $\in \frac{\mathbb{Z}}{m!} $, but I have a pretty hard time visualising this group!
Thanks for the help!
 A: Watch what happens for $x = \frac{p}{q}$ when you evaluate $$
  f_m(x) = \lim_{n\to\infty} \left(\cos(m!\pi x)\right)^{2n} \text{.}
$$
If $p \mid m!$, you have $\cos(m!\pi x) = \cos(\pi k) = \pm 1$ for some $k \in \mathbb{Z}$ ($k = \frac{m!p}{q}$, to be precise). It follows that $$
  f_m(x) = \lim_{n\to\infty} (\pm 1)^{2n} = 1 \text{ if $x = \frac{p}{q}$ is rational and $p \mid m!$.}
$$
On the other hand, if $x$ is irrational, $m!x \notin \mathbb{Z}$ for all $m$, and therefore $\left|\cos(m!\pi x)\right| < 1$. It follows that $$
  f_m(x) = \lim_{n\to\infty} \left(\cos(m!\pi x)\right)^{2n} = 0 \text{ if $x$ is irrational.}
$$
What remains to show is that $$
  \lim_{m\to\infty} f_m(x) = f(x) = \begin{cases}
    1 &\text{if $x \in \mathbb{Q}$} \\
    0 &\text{otherwise.}
  \end{cases}
$$
For that, just observe that if $x = \frac{p}{q}$ is rational, you surely have $p \mid m!$ if $m \geq p$.
A: Expanding on the hint, if $m!x\in \mathbb Z$ then $(\cos(m!\pi x))^{2n}=1$ for all $n$, otherwise $0\le (\cos(m!\pi x))^2<1$ so $(\cos(m!\pi x))^{2n}\to 0$. Thus
$$f_m(x)=\begin{cases}
1&\text{if } x=\frac{n}{m!}\\
0&\text{otherwise}
\end{cases}$$
Now note that if $\frac{a}{b}\in \mathbb Q$ then $\frac{a}{b}=\frac{a(b-1)!}{b!}$, so $f_m(x)=1$ for $\frac{a}{b}$ when $m\ge b$. Thus $f(x) = 1$ for rational $x$ and $0$ for irrational $x$.
