5. Find all two-digit numbers $n=\overline{a b}$ (where $a \geqslant 1, a, b \in\{0,1,2, \cdots, 9\}$), such that for any $x \in \mathbf{Z}$, we have $n \mid\left(x^{a}-x^{b}\right)$.
5. First, $n=11,22, \cdots, 99$ satisfy the condition. When $a \neq b$, let $p$ be a prime factor of $n$. By the condition, for any $x \in \mathbf{Z}$, we have $p \mid (x^a - x^b)$. Therefore, for any $x \in \{1, 2, \cdots, p-1\}$, we have $x^{|a-b|} \equiv 1 \pmod{p}$. Let $g$ be a primitive root modulo $p$, then we also have $g^{|a-b|} \equiv 1 \pmod{p}$, thus $(p-1) \mid |a-b|$. Noting that $|a-b| \leq 9$, we have $p \leq 10$, hence $p \in \{2,3,5,7\}$.

We discuss the cases separately.
(1) If $7 \mid n$, then similarly, we should have $6 \mid |a-b|$, in this case, $n=28$. Using Fermat's Little Theorem and the property of squares modulo 4, we can see that $n=28$ satisfies the condition.
(2) If $7 \nmid n$, but $5 \mid n$. Similarly, we have $4 \mid |a-b|$, so $n \in \{15,40\}$. Direct verification shows that $n=15$ satisfies the condition.
(3) If $7 \nmid n$, $5 \nmid n$, but $3 \mid n$, we have $2 \mid |a-b|$, so $n \in \{24,48\}$. Direct verification shows that $n=48$ satisfies the condition.
(4) If $7 \nmid n$, $5 \nmid n$, $3 \nmid n$, but $2 \mid n$, then $n \in \{16,32,64\}$, none of which meet the requirements.

In summary, the $n$ that satisfy the condition are $n=11,22, \cdots, 99,15,28,48$.