7. Given the equality

$$
\left(a^{m_{1}}-1\right) \ldots\left(a^{m_{n}}-1\right)=\left(a^{k_{1}}+1\right) \ldots\left(a^{k_{l}}+1\right)
$$

where $a, n, l$ and all exponents are natural numbers, and $a>1$. Find all possible values of the number $a$.
7. The values $a=2$ and $a=3$ are possible: for example, $2^{2}-1=2+1, (3-1)^{2}=3+1$. Suppose that for some $a>3$ the required equality holds:

$$
A=\left(a^{m_{1}}-1\right) \ldots\left(a^{m_{n}}-1\right)=\left(a^{k_{1}}+1\right) \ldots\left(a^{k_{l}}+1\right)
$$

Lemma 1. Any $m_{i}$ and $a-1$ are powers of two.

Proof. Let $\gamma$ be an arbitrary odd divisor of the number $m_{i}$ (possibly $\gamma=1$), and let $p$ be any prime divisor of the number $a^{\gamma}-1$. Then $A$ is divisible by $p$ (see fact 8), which means that in the right product there is a factor $a^{k_{j}}+1$ that is divisible by $p$ (see fact 9). Note that

$$
\left(\left(a^{k_{j}}\right)^{\gamma}+1\right)-\left(\left(a^{\gamma}\right)^{k_{j}}-1\right)=2
$$

On the other hand, $\left(a^{k_{j}}\right)^{\gamma}+1$ is divisible by $p$ since $a^{k_{j}}+1$ is divisible by $p$, and $\left(a^{\gamma}\right)^{k_{j}}-1$ is divisible by $p$ since $a^{\gamma}-1$ is divisible by $p$. Therefore, 2 is divisible by $p$, hence $p=2$. Thus, 2 is the only prime divisor of the number $a^{\gamma}-1$, meaning that $a^{\gamma}-1$ is a power of two (see fact 10), i.e., there exists some $K$ such that $2^{K}=a^{\gamma}-1=\left(a^{\gamma-1}+\ldots+a+1\right)(a-1)$. Since $\gamma$ is odd, the expression in the first parenthesis is an odd divisor of the number $2^{K}$, i.e., 1. Therefore, $\gamma=1$. Consequently, $a-1=2^{K}$. Moreover, we have proved that one is the only odd divisor of the number $m_{i}$, meaning that $m_{i}$ is a power of two. The lemma is proved.

Since $a-1>2$, then $a-1$ is divisible by 4, so $a^{k}+1$ gives a remainder of 2 when divided by 4 for any $k$ (see fact 7).

Let $a_{i}=\frac{a^{2^{i}}+1}{2}$. Then $a_{i}$ is an odd number. We will need the following formula:

$$
\begin{aligned}
a^{2^{d}}-1=(a-1)(a+1)\left(a^{2}+1\right)\left(a^{4}+1\right) & \ldots\left(a^{2^{d-1}}+1\right)= \\
& =2^{K} \cdot 2^{d} \cdot a_{0} \ldots a_{d-1} .
\end{aligned}
$$

Lemma 2. All $a_{i}$ are pairwise coprime.

Proof. Consider the numbers $a_{i}$ and $a_{j}$ and prove that they are coprime. We can assume that $i>j$. By (2), $a^{2^{i}}-1$ is divisible by $a_{j}$, and on the other hand, $a^{2^{i}}+1$ is divisible by $a_{i}$. Therefore, any common divisor of the numbers $a_{i}$ and $a_{j}$ is also a divisor of the number

$$
2=\left(a^{2^{i}}+1\right)-\left(a^{2^{i}}-1\right) .
$$

To complete the proof, it remains to note that the numbers $a_{i}$ and $a_{j}$ are odd. The lemma is proved.

Multiplying the representations (2) for $a^{2^{m_{i}}}-1$, we obtain that $A$ is represented as $A=2^{N}\left(a_{0}\right)^{N_{0}} \ldots\left(a_{q}\right)^{N_{q}}$, where $N>N_{0}+\ldots+N_{q}$. Since each of the numbers $a^{k_{j}}+1$ gives a remainder of 2 when divided by 4, then $l=N$ (see (1)). But each of $a^{k_{j}}+1$ is divisible by one of the numbers $a_{i}$ (indeed, if $k_{j}=2^{r} s$, where $s$ is odd, then $a^{k_{j}}+1$ is divisible by $a_{r}$). Then, since $l>N_{0}+\ldots+N_{q}$, more than $N_{i}$ numbers $a^{k_{j}}+1$ are divisible by some $a_{i}$, and therefore, $A$ is divisible by $a_{i}^{N_{i}+1}$. This contradicts the fact that $a_{i}$ are odd and pairwise coprime.