Why is an exponent of $2n$ necessary in Dirichlet's Function? For those unfamiliar, a question explaining the definition is in the question here. The definition itself is
$$\lim_{m\to\infty}\lim_{n\to\infty}\cos^{2n}\left(m!\pi x\right)$$
and evaluates to 1 for rational $x$ and 0 for irrational $x$. The part I don't totally understand is why the exponent is $2n$ as opposed to just $n$.
This is a very-not rigorous question, but my concern stems from the fact that as $n\to\infty$, $2n$ isn't necessarily even, let alone an integer, which negates the whole point of making rational values become $1$ instead of $\pm1$. It seems like you could, on the other hand, write it as
$$\lim_{m\to\infty}\lim_{n\to\infty}\left(\cos^{2}\left(m!\pi x\right)\right)^n$$
although I'm not entirely sure if this is the same expression.
My other question is that if the first equation is 'right', it seems to like it logically follows that
$$\lim_{n\to\infty}(-1)^{2n}=1$$
as well. Is this true?
 A: There's going to be a lot of weasel words in this answer but bear with me.
Generally speaking variables that are named $i,j,k$ or $m,n$ are always integers. Also often limits that go to infinity are limits over sequences (indexed by integers) rather than limits over real numbers. Therefore, any time I see "$\lim_{n \to \infty}$" I assume that it is a limit over a sequence indexed by $n$ and hence $n$ is an integer. In many cases it doesn't matter if you consider a limit over the integers or over the real numbers but sometimes it does, as in this example.
You will also notice that "$m!$" isn't defined when $m$ is non-integral. So we must interpret $m$ to be an integer as well. (You can define $!$ at non-integer input but that isn't normally part of the definition.)
A: You were concerned that as $n\to \infty$, $2n$ is not necessarily even, let alone an integer, 
but in the definition of the Dirichlet function in Wikipedia, $n$ is an integer.  
Therefore, at rational numbers, the Dirichlet function becomes $1$, not $\pm1$,
and you could write $\lim\limits_{m\to\infty}\lim\limits_{n\to\infty}\left(\cos^{2}\left(m!\pi x\right)\right)^n$ instead of $\lim\limits_{m\to\infty}\lim\limits_{n\to\infty}\cos^{2n}\left(m!\pi x\right),$ 
and $\lim\limits_{n\to\infty}(-1)^{2n}=\lim\limits_{n\to\infty}((-1)^2)^n=\lim\limits_{n\to\infty}1^n=\lim\limits_{n\to\infty}1=1.$
