Periodicity of discrete time signal: $x\left [ n \right ] = \cos (\frac{\pi n^{2}}{8})$

I need to find the periodicity of the following signal:
$$x\left [ n \right ] = \cos (\frac{\pi n^{2}}{8})$$
Now I understand that the basic procedure to determine the periodicity is to find a $N$ such that $x\left [ n \right ] = x\left [ n + N\right ]$.
I applied the procedure to the aforementioned signal and got the following results:
$$x\left [ n \right ] = \cos (\frac{\pi n^{2}}{8}) \\ x\left [ n + N\right ]= \cos (\frac{\pi (n + N)^{2}}{8})\\ = \cos (\frac{\pi (n^{2} + 2nN + N^{2})}{8})\\ = \Re \left \{\exp (i \frac{\pi (n^{2} + 2nN + N^{2})}{8}) \right \}\\ = \Re \left \{\exp (i \frac{\pi n^{2}}{8})\exp (i \frac{\pi 2nN}{8})\exp (i \frac{\pi N^{2}}{8}) \right \}$$ Now for the signal to conform to $x\left [ n \right ] = x\left [ n + N\right ]$: $$\Re \left \{\exp (i \frac{\pi 2nN}{8})\exp (i \frac{\pi N^{2}}{8}) \right \} = 1$$ $\exp(i\omega) = 1$ only when $\omega = 2\pi k$ where $k$ is an integer. Hence:
$$\frac{\pi 2nN}{8} = \frac{\pi N^{2}}{8} = 2\pi k$$ Now logically I can see that if $N = 8$ the first term would be reduced to a multiple of $2\pi$ for all $n$ and hence the fundamental period would be $N = 8$ but how would I go about proving this mathematically, that the minimum period is indeed 8? like what set of operations would I perform on:
$$\frac{\pi 2nN}{8} = \frac{\pi N^{2}}{8} = 2\pi k$$
to obtain $N = 8$?

You want to prove that $\frac{nN}{8}$ is an integer for any integer $n$. Consider $n=1$. Clearly, $N$ cannot be less than 8.

You also need to prove that $\frac{N^2}{16}$ is an integer. This means that $N$ is a multiple of 4. So, the smallest $N$ that meets both conditions is 8.

You have to prove that the period $N$ is the smallest number satisfying

$$\frac{\pi}{8}(n+N)^2=\frac{\pi n^2}{8}+2\pi k,\quad k\in\mathbb{N}\tag{1}$$

From (1) you get

$$\frac{\pi}{8}n^2+\frac{\pi}{8}2nN+\frac{\pi}{8}N^2=\frac{\pi n^2}{8}+2\pi k$$

which is equivalent to

$$\frac{\pi}{8}2nN+\frac{\pi}{8}N^2=2\pi k\tag{2}$$

or

$$2nN+N^2=16k\tag{3}$$

for any value of $n$. Clearly, the smallest number $N$ for which the left-hand side of (3) is a multiple of $16$, regardless of the value of $n$, is $N=8$:

$$16n+16\cdot 4=16k$$