If $p$ is a prime positive integer and  $x,y$ are positive integers, 
find , in terms of $p$, all pairs $(x,y)$ that are solutions of the equation: $p(x-2)=x(y-1)$. (1)
If it is also given that $x+y=21$, find all triplets  $(x,y,p)$ that are solutions to equation (1).
1. Start with the given equation:
   \[
   p(x-2) = x(y-1)
   \]
   Rearrange to isolate \( y \):
   \[
   y - 1 = \frac{p(x-2)}{x}
   \]
   Simplify the right-hand side:
   \[
   y - 1 = p - \frac{2p}{x}
   \]
   For \( y - 1 \) to be an integer, \( \frac{2p}{x} \) must also be an integer. This implies that \( x \) must be a divisor of \( 2p \).

2. The divisors of \( 2p \) are \( 1, 2, p, \) and \( 2p \). We will consider each case:
   - If \( x = 1 \):
     \[
     y - 1 = p - \frac{2p}{1} = p - 2p = -p
     \]
     \[
     y = 1 - p
     \]
     Since \( y \) must be a positive integer, this case is not valid.
   - If \( x = 2 \):
     \[
     y - 1 = p - \frac{2p}{2} = p - p = 0
     \]
     \[
     y = 1
     \]
     This gives the pair \( (x, y) = (2, 1) \).
   - If \( x = p \):
     \[
     y - 1 = p - \frac{2p}{p} = p - 2
     \]
     \[
     y = p - 1
     \]
     This gives the pair \( (x, y) = (p, p-1) \).
   - If \( x = 2p \):
     \[
     y - 1 = p - \frac{2p}{2p} = p - 1
     \]
     \[
     y = p
     \]
     This gives the pair \( (x, y) = (2p, p) \).

3. Therefore, the positive integer solutions are:
   \[
   (x, y) = (2, 1), (p, p-1), (2p, p)
   \]

4. For the second part, we are given \( x + y = 21 \). We will check each pair:
   - For \( (x, y) = (2, 1) \):
     \[
     2 + 1 = 3 \neq 21
     \]
     This pair is not valid.
   - For \( (x, y) = (p, p-1) \):
     \[
     p + (p-1) = 2p - 1 = 21
     \]
     \[
     2p - 1 = 21 \implies 2p = 22 \implies p = 11
     \]
     This gives the triplet \( (x, y, p) = (11, 10, 11) \).
   - For \( (x, y) = (2p, p) \):
     \[
     2p + p = 3p = 21
     \]
     \[
     3p = 21 \implies p = 7
     \]
     This gives the triplet \( (x, y, p) = (14, 7, 7) \).

The final answer is \(\boxed{(11, 10, 11), (14, 7, 7)}\).