Find all positive integers $n$ such that for any positive integer $a$ relatively prime to $n$, $2n^2 \mid a^n - 1$.
1. **Initial Consideration**:
   - We need to find all positive integers \( n \) such that for any positive integer \( a \) relatively prime to \( n \), \( 2n^2 \mid a^n - 1 \).
   - Clearly, \( n = 1 \) does not work because \( 2n^2 = 2 \) and \( a^1 - 1 = a - 1 \) is not always divisible by 2 for all \( a \).

2. **Odd Prime Divisors**:
   - Assume \( n \) has an odd prime divisor \( p \). Let \( x = v_p(n) \) (the highest power of \( p \) dividing \( n \)).
   - Since there exists a primitive root modulo \( p^m \) for all \( m \geq 1 \), take a primitive root \( g \) modulo \( p^{2x} \).
   - Choose \( t \) such that \( t \equiv g \pmod{p^{2x}} \) and \( t \equiv 1 \pmod{q^{v_q(n)}} \) for all other primes \( q \) dividing \( n \). This is possible by the Chinese Remainder Theorem.

3. **Primitive Root Argument**:
   - Let \( a = t \). Then \( t^n \equiv g^n \equiv 1 \pmod{p^{2x}} \).
   - This implies \( p^{2x - 1}(p - 1) \mid n \). From this, we deduce that \( n \) cannot be odd because \( p \) is an odd prime and \( p^{2x - 1}(p - 1) \) is even.

4. **Valuation Argument**:
   - Thus, \( x \geq 2x - 1 \implies x \leq 1 \implies x = 1 \). So, \( p \) appears exactly once in the factorization of \( n \).

5. **Power of 2**:
   - Let \( y = v_2(n) \). By the Lifting The Exponent (LTE) lemma, we have \( v_2(a^n - 1) = v_2(a - 1) + v_2(a + 1) + y - 1 \).
   - Choose \( a \) such that \( a \equiv 3 \pmod{8} \) and \( a \) is coprime to \( n \). Then, \( v_2(a + 1) = 2 \) and \( v_2(a - 1) = 1 \).
   - So, \( 2y + 1 \leq y + 2 \implies y \leq 1 \implies y = 1 \).

6. **Squarefree Condition**:
   - Therefore, \( n \) is squarefree. If \( n \) does not have any odd prime divisor, then \( n = 2 \) and this works.

7. **Odd Prime Divisors**:
   - Let \( 2 < p_1 < p_2 < \dots < p_k \) be the odd prime divisors of \( n \). So \( n = 2p_1p_2 \dots p_k \).
   - From earlier, we have \( p_i - 1 \mid n \) for all \( 1 \leq i \leq k \).

8. **Finding Specific Primes**:
   - \( p_1 - 1 \mid 2p_1 \implies p_1 = 3 \).
   - \( p_2 - 1 \mid 6p_2 \implies p_2 - 1 \mid 6 \implies p_2 = 7 \).
   - \( p_3 - 1 \mid 42p_3 \implies p_3 - 1 \mid 42 \implies p_3 = 43 \).
   - \( p_4 - 1 \mid 1806p_4 \implies p_4 - 1 \mid 1806 \). There does not exist such a prime \( p_4 > 43 \).

9. **Conclusion**:
   - Thus, \( k \leq 3 \).
   - If \( k = 1 \), then \( n = 6 \).
   - If \( k = 2 \), then \( n = 42 \).
   - If \( k = 3 \), then \( n = 1806 \).

Therefore, all solutions are \( n = 2, 6, 42, 1806 \).

The final answer is \(\boxed{2, 6, 42, 1806}\).