Given a positive integer $n$, let $\tau(n)$ denote the number of positive divisors of $n$ and $\varphi(n)$ denote the number of positive integers not exceeding $n$ that are relatively prime to $n$. Find all $n$ for which one of the three numbers $n,\tau(n), \varphi(n)$ is the arithmetic mean of the other two.
We need to find all positive integers \( n \) for which one of the three numbers \( n, \tau(n), \varphi(n) \) is the arithmetic mean of the other two. We will consider each case separately.

### Case 1: \( n = \frac{\varphi(n) + \tau(n)}{2} \)

1. **Assume \( n = p \) where \( p \) is a prime number:**
   \[
   \tau(p) = 2 \quad \text{and} \quad \varphi(p) = p - 1
   \]
   \[
   p = \frac{(p - 1) + 2}{2} = \frac{p + 1}{2}
   \]
   \[
   2p = p + 1 \implies p = 1
   \]
   This is a contradiction since 1 is not a prime number. Thus, \( n \) cannot be a prime number.

2. **General case:**
   \[
   2n = \varphi(n) + \tau(n)
   \]
   Using the inequality \( \tau(n) \leq 2\sqrt{n} \):
   \[
   2n \leq \varphi(n) + 2\sqrt{n}
   \]
   Since \( \varphi(n) \leq n \):
   \[
   2n \leq n + 2\sqrt{n}
   \]
   \[
   n \leq 2\sqrt{n}
   \]
   \[
   n^2 \leq 4n \implies n(n - 4) \leq 0
   \]
   This inequality holds for \( n \leq 4 \). Checking \( n = 1, 2, 3, 4 \):
   - \( n = 1 \):
     \[
     \tau(1) = 1, \quad \varphi(1) = 1
     \]
     \[
     1 = \frac{1 + 1}{2} = 1
     \]
     This is true.
   - \( n = 2 \):
     \[
     \tau(2) = 2, \quad \varphi(2) = 1
     \]
     \[
     2 \neq \frac{1 + 2}{2} = 1.5
     \]
     This is false.
   - \( n = 3 \):
     \[
     \tau(3) = 2, \quad \varphi(3) = 2
     \]
     \[
     3 \neq \frac{2 + 2}{2} = 2
     \]
     This is false.
   - \( n = 4 \):
     \[
     \tau(4) = 3, \quad \varphi(4) = 2
     \]
     \[
     4 \neq \frac{2 + 3}{2} = 2.5
     \]
     This is false.

   Thus, \( n = 1 \) is the only solution in Case 1.

### Case 2: \( \tau(n) = \frac{\varphi(n) + n}{2} \)

1. **Check small values of \( n \):**
   - \( n = 2 \):
     \[
     \tau(2) = 2, \quad \varphi(2) = 1
     \]
     \[
     2 \neq \frac{1 + 2}{2} = 1.5
     \]
     This is false.
   - \( n = 6 \):
     \[
     \tau(6) = 4, \quad \varphi(6) = 2
     \]
     \[
     4 = \frac{2 + 6}{2} = 4
     \]
     This is true.

2. **General case:**
   \[
   2\tau(n) = \varphi(n) + n
   \]
   Using the inequality \( \tau(n) \leq 2\sqrt{n} \):
   \[
   2\sqrt{n} \geq \frac{\varphi(n) + n}{2}
   \]
   \[
   4\sqrt{n} \geq \varphi(n) + n
   \]
   Since \( \varphi(n) \geq \sqrt{n} \):
   \[
   4\sqrt{n} \geq \sqrt{n} + n
   \]
   \[
   3\sqrt{n} \geq n
   \]
   \[
   9 \geq n
   \]
   Checking \( n = 1, 2, 3, 4, 5, 6, 7, 8, 9 \):
   - \( n = 1 \):
     \[
     \tau(1) = 1, \quad \varphi(1) = 1
     \]
     \[
     1 = \frac{1 + 1}{2} = 1
     \]
     This is true.
   - \( n = 4 \):
     \[
     \tau(4) = 3, \quad \varphi(4) = 2
     \]
     \[
     3 = \frac{2 + 4}{2} = 3
     \]
     This is true.
   - \( n = 6 \):
     \[
     \tau(6) = 4, \quad \varphi(6) = 2
     \]
     \[
     4 = \frac{2 + 6}{2} = 4
     \]
     This is true.

   Thus, \( n = 1, 4, 6 \) are the solutions in Case 2.

### Case 3: \( \varphi(n) = \frac{\tau(n) + n}{2} \)

1. **Assume \( \varphi(n) \leq \frac{n}{2} \):**
   \[
   \frac{\tau(n) + n}{2} = \varphi(n) \leq \frac{n}{2}
   \]
   \[
   \tau(n) \leq 0
   \]
   This is a contradiction, so \( \varphi(n) > \frac{n}{2} \). This implies \( n \) must be odd.

2. **Check if \( n \) is a square:**
   \[
   2\varphi(n) = \tau(n) + n
   \]
   For \( n \) to be odd and a square, let \( n = \prod_{i=1}^{k} p_i^{2\alpha_i} \):
   \[
   2\prod_{i=1}^{k} p_i^{2\alpha_i - 1}(p_i - 1) = \prod_{i=1}^{k} p_i^{2\alpha_i} + \prod_{i=1}^{k} (2\alpha_i + 1)
   \]
   This implies:
   \[
   \prod_{i=1}^{k} (2\alpha_i + 1) \geq \prod_{i=1}^{k} p_i^{2\alpha_i - 1}
   \]
   The equality holds when \( p_i = 3 \) and \( \alpha_i = 1 \):
   \[
   n = 3^2 = 9
   \]

   Thus, \( n = 9 \) is the solution in Case 3.

In conclusion, the solutions are:
\[
\boxed{n = 1, 4, 6, 9}
\]