For a positive integer $n$, let $A_n$ be the set of all positive numbers greater than $1$ and less than $n$ which are coprime to $n$. Find all $n$ such that all the elements of $A_n$ are prime numbers.
1. **Initial Considerations**:
   - For \( n = 1 \) and \( n = 2 \), the set \( A_n \) is empty because there are no positive integers greater than 1 and less than \( n \). Hence, \( n = 1 \) and \( n = 2 \) are not solutions.
   - We consider \( n > 2 \).

2. **Key Step**:
   - We need to show that for all primes \( p \leq \sqrt{n} \), \( p \mid n \). Suppose otherwise, i.e., there exists a prime \( p < \sqrt{n} \) such that \( p \nmid n \).
   - Since \( \gcd(p^2, n) = 1 \) and \( p^2 < n \), \( p^2 \in A_n \). This contradicts the fact that \( A_n \) consists only of primes. Therefore, for all primes \( p \leq \sqrt{n} \), \( p \mid n \).

3. **Sufficiency of the Condition**:
   - We need to show that if \( p \mid n \) for all primes \( p \leq \sqrt{n} \), then all elements of \( A_n \) are prime.
   - Pick any \( t \in A_n \). We will show that \( t \) is prime.
   - Clearly, \( t > \sqrt{n} \) because \( p \mid n \) for all \( p \leq \sqrt{n} \).
   - If \( t \) is not prime, then let \( q \) be its smallest prime factor. Since \( q \leq \sqrt{t} < \sqrt{n} \), \( q \mid n \), which contradicts \( q \in A_n \). Hence, \( t \) must be prime.

4. **Finding \( n \)**:
   - We need to find all positive integers \( n \) such that for all primes \( p \leq \sqrt{n} \), \( p \mid n \).
   - For \( n > 40 \), we have \( n < \pi(\sqrt{n})! \). This is because \( n! > \left(\frac{n}{2}\right)^{\frac{n}{2}} \) and \( \pi(n) > \frac{n-1}{2 \ln n} \).
   - Therefore, it is not possible to have all primes \( p < \sqrt{n} \) dividing \( n \) for \( n > 40 \), as otherwise \( n \geq \prod_{p \leq \sqrt{n}} p > \pi(\sqrt{n})! > n \), a contradiction.
   - Thus, \( n \leq 40 \).

5. **Checking \( n \leq 40 \)**:
   - We check each \( n \leq 40 \) to see if all elements of \( A_n \) are prime.
   - The solutions are \( n = 3, 4, 6, 8, 12, 18, 24, 30 \).

The final answer is \( \boxed{ n = 3, 4, 6, 8, 12, 18, 24, 30 } \).