Given a prime number $p$. A positive integer $x$ is divided by $p$ with a remainder, and the number $p^2$ is divided by $x$ with a remainder. The remainders turned out to be equal. Find them

[i]Proposed by Sergey Berlov[/i]
Given a prime number \( p \), we need to find the remainder \( r \) when a positive integer \( x \) is divided by \( p \) and when \( p^2 \) is divided by \( x \), such that the remainders are equal.

1. Let the remainder be \( r \). Then we have:
   \[
   x \equiv r \pmod{p} \quad \text{and} \quad p^2 \equiv r \pmod{x}
   \]
   This implies:
   \[
   x = kp + r \quad \text{for some integer } k
   \]
   and
   \[
   p^2 = mx + r \quad \text{for some integer } m
   \]

2. From \( x = kp + r \), we can write:
   \[
   r = x - kp
   \]
   Substituting this into \( p^2 = mx + r \), we get:
   \[
   p^2 = mx + (x - kp)
   \]
   Simplifying, we have:
   \[
   p^2 = (m+1)x - kp
   \]

3. Rearranging, we get:
   \[
   (m+1)x = p^2 + kp
   \]
   Since \( x \) must be an integer, \( (m+1)x \) must be divisible by \( p \). This implies that \( x \) must be of the form \( p \) or a multiple of \( p \).

4. Consider the case when \( x = p \):
   \[
   r = p - kp = 0
   \]
   So, \( r = 0 \).

5. Consider the case when \( x = p^2 \):
   \[
   r = p^2 - kp = 0
   \]
   So, \( r = 0 \).

6. Consider the case when \( x \) is not a multiple of \( p \). Then \( (x, p) = 1 \). We have:
   \[
   x \geq p + 1
   \]
   and
   \[
   x \mid p^2 + x - r
   \]
   Since \( x \mid p^2 + x - r \) and \( x \mid p^2 \), we have:
   \[
   x \mid (p^2 + x - r) - p^2 = x - r
   \]
   This implies:
   \[
   x - r = 0 \quad \text{or} \quad x = r
   \]
   Since \( x \geq p + 1 \), we have:
   \[
   x = p + 1 \quad \text{and} \quad r = 1
   \]

Conclusion:
The possible values of \( (x, p) \) are:
\[
(x, p) = (p, p), (p^2, p), (p + 1, p)
\]

The final answer is \( \boxed{ (x, p) = (p, p), (p^2, p), (p + 1, p) } \).