I read that the Dirichlet function ($1$ if Rational, $0$ else) can be written as:
$$ D(x)=\lim_{m\to\infty}\lim_{n\to\infty} \cos^{2n}(m!\pi x)$$
What is the proof of that? Are those limits commutative? Is there any other closed formula for Dirichlet function? (With one limit? none?)
Thank you!
P.S: The reason I try to understand Dirichlet function is because I need to write a function $f(a,b)$ that indicated if $a$ AND $b$ are rational. (The way of indication doesn't really matter, but $D(a)D(b)$ is the only idea I had in mind, yet, I need to write the function as closed one)