4. If $\quad a=\overline{a_{1} a_{2} a_{3} a_{4} a_{5} a_{6}}, \quad$ then $\quad P(a)=\overline{a_{6} a_{1} a_{2} a_{3} a_{4} a_{5}}$, $P(P(a))=\overline{a_{5} a_{6} a_{1} a_{2} a_{3} a_{4}} \quad$ with $\quad a_{5} \neq 0, a_{6} \neq 0, a_{1} \neq 0 . \quad$ From the equality $P(P(a))=a$ it follows that $a_{1}=a_{5}, a_{2}=a_{6}, a_{3}=a_{1}$, $a_{4}=a_{2}, a_{5}=a_{3}, a_{6}=a_{4}$, that is, $a_{1}=a_{3}=a_{5}=t, t=1,2, \ldots, 9$ and $a_{2}=a_{4}=a_{6}=u, u=1,2, \ldots, 9$. Thus, the sought $a=\overline{\text { tututu }}$ and there are 81 such different numbers ( $t$ and $u$ can take any values of the decimal system digits from 1 to 9).

Let $n>2-$ be a prime number, $a=\overline{a_{1} a_{2} a_{3} a_{4} \ldots a_{n-3} a_{n-2} a_{n-1} a_{n}}$. Then

$$
\begin{gathered}
P(a)=\overline{a_{n} a_{1} a_{2} a_{3} a_{4} \ldots a_{n-3} a_{n-2} a_{n-1}} \\
P(P(a))=\overline{a_{n-1} a_{n} a_{1} a_{2} a_{3} a_{4} \ldots a_{n-3} a_{n-2}}
\end{gathered}
$$

The property $P(P(a))=a$ gives the relations $a_{1}=a_{n-1}=a_{n-3}=\ldots=a_{1}$. For a prime $n>2$, all the digits of the number $a$ are involved in the chain, so they are all equal to each other.
Answer: 1) 81 is the number; 2) $a=\overline{t u t u t u}, t, u$, where $t, u$ - are any digits, not equal to zero.