$\lim_{n \to \infty}(\lim_{k \to \infty}(\cos(n!\pi x)^{2k}))$ Identify the function $f(x) = \displaystyle \lim_{n \to \infty}(\lim_{k \to \infty}(\cos(n!\pi x)^{2k}))$.


I was confused how to find this limit because cosine oscillates, so I didn't think it was possible to find the limit.
Set $$D_n = \{ x \in \mathbb{Q} \, : \, x=p/q \text{ with } q \text{ integer divisor of } n! \}. $$It is enough to notice that $$\lim_{m \to \infty} [\cos^2 (n! \pi x)]^m=\begin{cases} 1 &amp; \text{if } x \in D_n \\  0 &amp; \text{if } x \in \mathbb{R} \setminus D_n \end{cases}=f_n(x).$$Since $$\bigcup_{n=1}^\infty D_n = \mathbb{Q}$$we have that $$\lim_n f_n(x) = \chi_{\mathbb{Q}} (x)= \begin{cases} 1 &amp; \text{if } x \in \mathbb{Q} \\ 0 &amp; \text{if } x \in \mathbb{R} \setminus \mathbb{Q} \end{cases}$$
if x \in Q then x = p/q 
  then for some very large n  n!/q is even number therefore making 
      cos(n! \pi x) = 1
hence making the limit 1

else if x is irrational then (n!\pi x) is never \pi hence
     Z = (cos(n! \pi x) )^2 &lt;1
 implies Z^k=1 
for all k