<s>[INST] What is the smallest positive integer $n$ such that $(a+1)^{7^n} = (a+1)$? In $\mathbb{F} = \mathbb{F}_7[X]/(X^2+1)$ let $a$ be the class of $X$. What is the smallest positive integer $n$ such that $(a+1)^{7^n} = (a+1)$ ?
I know that the answer is $2$ but I don't see how it works. Can someone explain the logic to me? Because if I get it correctly, $a = X$ in this case and we're reducing $mod$ $X^2 +1$ so how does $ a^{49} +1$ equal to $a+1$ ?
 [/INST] The question can be rephrased as

What is the smallest positive integer $n$ such that $(a+1)^{7n-1} = 1$?

Let $m$ be the order of $a+1$ in the multiplicative group $\Bbb{F}^\times$, which has order $48$.
Then $m$ divides $\gcd(7n-1,48)$. Let's see the possibilities:
$$
\begin{array}{r|rrrrrrr}
n & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
7n-1 & 6 & 13 & 20 & 27 & 34 & 41 & 48 \\
\gcd(7n-1,48) & 6 & 1 & 4 & 3 & 2 & 1 & 48
\end{array}
$$
By checking that $(a+1)^k \ne 1$ for $k=1,2,3,4,6$, we arrive at $n=7$.
</s>