Let $n$ be a positive integer and $d(n)$ be the number of positive divisors of $n$.
Find all $n$ such that $n^{d(n)+1}(n+21)^{d(n)}$ is a square.
1. **Understanding the problem**: We need to find all positive integers \( n \) such that \( n^{d(n)+1}(n+21)^{d(n)} \) is a perfect square, where \( d(n) \) is the number of positive divisors of \( n \).

2. **Case 1: \( n \) is not a perfect square**:
   - If \( n \) is not a perfect square, then \( d(n) \) is even. This is because the number of divisors of a non-square number is always even.
   - Therefore, \( n^{d(n)+1} \) is not necessarily a perfect square because \( d(n)+1 \) is odd.
   - However, \( (n+21)^{d(n)} \) is a perfect square because \( d(n) \) is even.
   - This implies that \( n^{d(n)+1}(n+21)^{d(n)} \) cannot be a perfect square unless \( n \) itself is a perfect square, leading to a contradiction.

3. **Case 2: \( n \) is a perfect square**:
   - Let \( n = k^2 \) for some positive integer \( k \).
   - Since \( n \) is a perfect square, \( d(n) \) is odd. This is because the number of divisors of a perfect square is always odd.
   - We need \( n^{d(n)+1}(n+21)^{d(n)} \) to be a perfect square.
   - Substituting \( n = k^2 \), we get \( (k^2)^{d(k^2)+1}(k^2+21)^{d(k^2)} \).
   - Since \( d(k^2) \) is odd, let \( d(k^2) = 2m+1 \) for some integer \( m \).
   - Therefore, \( (k^2)^{2m+2}(k^2+21)^{2m+1} \) must be a perfect square.
   - Simplifying, we get \( k^{4m+4}(k^2+21)^{2m+1} \).

4. **Condition for \( k^2 + 21 \) to be a perfect square**:
   - For \( k^{4m+4}(k^2+21)^{2m+1} \) to be a perfect square, \( k^2 + 21 \) must be a perfect square.
   - Let \( k^2 + 21 = u^2 \) for some integer \( u \).
   - This implies \( u^2 - k^2 = 21 \), which can be factored as \( (u-k)(u+k) = 21 \).

5. **Solving the equation \( (u-k)(u+k) = 21 \)**:
   - The factor pairs of 21 are (1, 21), (3, 7), (7, 3), and (21, 1).
   - Solving for each pair:
     - \( u - k = 1 \) and \( u + k = 21 \):
       - Adding these equations, \( 2u = 22 \Rightarrow u = 11 \).
       - Subtracting these equations, \( 2k = 20 \Rightarrow k = 10 \).
       - Thus, \( n = k^2 = 10^2 = 100 \).
     - \( u - k = 3 \) and \( u + k = 7 \):
       - Adding these equations, \( 2u = 10 \Rightarrow u = 5 \).
       - Subtracting these equations, \( 2k = 4 \Rightarrow k = 2 \).
       - Thus, \( n = k^2 = 2^2 = 4 \).

6. **Conclusion**:
   - The only values of \( n \) that satisfy the given condition are \( n = 4 \) and \( n = 100 \).

The final answer is \( \boxed{4 \text{ and } 100} \).