Find all positive integers $n$ for which there exist non-negative integers $a_1, a_2, \ldots, a_n$ such that
\[
\frac{1}{2^{a_1}} + \frac{1}{2^{a_2}} + \cdots + \frac{1}{2^{a_n}} = 
\frac{1}{3^{a_1}} + \frac{2}{3^{a_2}} + \cdots + \frac{n}{3^{a_n}} = 1.
\]

[i]Proposed by Dusan Djukic, Serbia[/i]
1. **Initial Observation:**
   We need to find all positive integers \( n \) for which there exist non-negative integers \( a_1, a_2, \ldots, a_n \) such that:
   \[
   \frac{1}{2^{a_1}} + \frac{1}{2^{a_2}} + \cdots + \frac{1}{2^{a_n}} = 1
   \]
   and
   \[
   \frac{1}{3^{a_1}} + \frac{2}{3^{a_2}} + \cdots + \frac{n}{3^{a_n}} = 1.
   \]

2. **Claim:**
   We claim that the answer is all \( n \equiv 1, 2 \pmod{4} \).

3. **Verification for Small Values:**
   Let's verify the claim for small values of \( n \):
   - For \( n = 1 \):
     \[
     \frac{1}{2^0} = 1 \quad \text{and} \quad \frac{1}{3^0} = 1.
     \]
   - For \( n = 2 \):
     \[
     \frac{1}{2^0} + \frac{1}{2^1} = 1 \quad \text{and} \quad \frac{1}{3^0} + \frac{2}{3^1} = 1.
     \]
   - For \( n = 5 \):
     \[
     \frac{1}{2^2} + \frac{1}{2^1} + \frac{1}{2^3} + \frac{1}{2^4} + \frac{1}{2^4} = 1
     \]
     and
     \[
     \frac{1}{3^2} + \frac{2}{3^1} + \frac{3}{3^3} + \frac{4}{3^4} + \frac{5}{3^4} = 1.
     \]
   - For \( n = 6 \):
     \[
     \frac{1}{2^2} + \frac{1}{2^2} + \frac{1}{2^3} + \frac{1}{2^3} + \frac{1}{2^3} + \frac{1}{2^3} = 1
     \]
     and
     \[
     \frac{1}{3^2} + \frac{2}{3^2} + \frac{3}{3^3} + \frac{4}{3^3} + \frac{5}{3^3} + \frac{6}{3^3} = 1.
     \]

4. **Induction Hypothesis:**
   Assume that for some \( k \in \mathbb{N} \), \( n = 4k+1 \) and \( n = 4k+2 \) work.

5. **Lemma 1:**
   If \( n = 4k+1 \) works, then \( n = 4k+2 \) also works.
   - **Proof:**
     Let \( a_1, a_2, \ldots, a_{4k+1} \) be the sequence that works for \( n = 4k+1 \).
     Consider the sequence \( a_1, a_2, \ldots, a_{2k}, a_{2k+1} + 1, a_{2k+2}, \ldots, a_{4k+1}, a_{2k+1} + 1 \).
     This sequence can be checked to satisfy both conditions for \( n = 4k+2 \).

6. **Lemma 2:**
   If \( n = 4k+2 \) works, then \( n = 4k+9 \) also works.
   - **Proof:**
     Let \( S = \{4k+3, 4k+4, \ldots, 4k+9\} \).
     We will color two elements of \( S \) red and the rest blue such that \(\frac{1}{3}\) of the sum of the red numbers plus the sum of the blue numbers is divisible by 8.
     By checking modulo 24, this is always possible.
     Let \( i \) be such that the sum of \(\frac{1}{3}\) of the red numbers and the blue numbers is \( 8i \).
     Change \( a_i \) to \( a_i + 2 \), and for \( x \in S \), set \( a_x = a_i + 3 \) if \( x \) is blue and \( a_i + 4 \) if \( x \) is red.
     Leave all other \( a_j \)'s unchanged.
     This works for \( n = 4k+9 \).

7. **Induction Conclusion:**
   By induction, for all \( k \in \mathbb{Z}_{\ge 0} \), \( n = 4k+1 \) and \( n = 4k+2 \) both work.

8. **Final Conclusion:**
   From the above, we conclude that the answer is exactly all \( n \) which are \( 1 \) or \( 2 \pmod{4} \).

\(\blacksquare\)

The final answer is \( \boxed{ n \equiv 1, 2 \pmod{4} } \).