Determine the prime numbers $p$ for which the number $a = 7^p - p - 16$ is a perfect square.

Lucian Petrescu
To determine the prime numbers \( p \) for which the number \( a = 7^p - p - 16 \) is a perfect square, we will analyze the given expression step-by-step.

1. **Check for \( p = 2 \):**
   \[
   a = 7^2 - 2 - 16 = 49 - 2 - 16 = 31
   \]
   Since 31 is not a perfect square, \( p = 2 \) is not a solution.

2. **Consider \( p \) to be an odd prime:**
   \[
   7^p - p - 16 \equiv (-1)^p - p - 16 \pmod{4}
   \]
   Since \( p \) is odd, \( (-1)^p = -1 \):
   \[
   7^p - p - 16 \equiv -1 - p - 16 \equiv -17 - p \pmod{4}
   \]
   Simplifying further:
   \[
   -17 - p \equiv -1 - p \equiv 0 \text{ or } 1 \pmod{4}
   \]
   This implies:
   \[
   p \equiv 1 \text{ or } 3 \pmod{4}
   \]
   Since \( p \) is an odd prime, \( p \equiv 3 \pmod{4} \).

3. **Check modulo \( p \):**
   \[
   x^2 = 7^p - p - 16
   \]
   We need \( 7^p - p - 16 \) to be a perfect square. Consider the expression modulo \( p \):
   \[
   7^p \equiv 7 \pmod{p} \quad \text{(by Fermat's Little Theorem)}
   \]
   Thus:
   \[
   7 - p - 16 \equiv x^2 \pmod{p}
   \]
   Simplifying:
   \[
   -9 \equiv x^2 \pmod{p}
   \]
   This implies:
   \[
   p \mid x^2 + 9
   \]
   Since \( x^2 + 9 \equiv 0 \pmod{p} \), we have:
   \[
   p \mid 9
   \]
   The only prime divisor of 9 is 3, so \( p = 3 \).

4. **Verify \( p = 3 \):**
   \[
   a = 7^3 - 3 - 16 = 343 - 3 - 16 = 324
   \]
   Since \( 324 = 18^2 \), it is indeed a perfect square.

Thus, the only prime number \( p \) for which \( 7^p - p - 16 \) is a perfect square is \( p = 3 \).

The final answer is \( \boxed{ p = 3 } \).