We say a nondegenerate triangle whose angles have measures $\theta_1$, $\theta_2$, $\theta_3$ is [i]quirky[/i] if there exists integers $r_1,r_2,r_3$, not all zero, such that
\[r_1\theta_1+r_2\theta_2+r_3\theta_3=0.\]
Find all integers $n\ge 3$ for which a triangle with side lengths $n-1,n,n+1$ is quirky.

[i]Evan Chen and Danielle Wang[/i]
1. **Define the angles and sides:**
   Let $\theta_1$ be the angle opposite the side $n+1$, $\theta_2$ opposite $n-1$, and $\theta_3$ opposite $n$. 

2. **Calculate the cosines and sines of the angles:**
   Using the Law of Cosines, we have:
   \[
   \cos \theta_1 = \frac{(n-1)^2 + n^2 - (n+1)^2}{2(n-1)n} = \frac{n^2 - 2n + 1 + n^2 - n^2 - 2n - 1}{2(n-1)n} = \frac{n-4}{2(n-1)}
   \]
   \[
   \cos \theta_2 = \frac{(n+1)^2 + n^2 - (n-1)^2}{2(n+1)n} = \frac{n^2 + 2n + 1 + n^2 - n^2 + 2n - 1}{2(n+1)n} = \frac{n+4}{2(n+1)}
   \]
   Using $\sin^2 \theta + \cos^2 \theta = 1$, we get:
   \[
   \sin \theta_1 = \sqrt{1 - \left(\frac{n-4}{2(n-1)}\right)^2} = \frac{\sqrt{3}}{2} \frac{\sqrt{n^2-4}}{n-1}
   \]
   \[
   \sin \theta_2 = \sqrt{1 - \left(\frac{n+4}{2(n+1)}\right)^2} = \frac{\sqrt{3}}{2} \frac{\sqrt{n^2-4}}{n+1}
   \]

3. **Apply the lemma:**
   **Lemma:** If $\cos \theta \not\in \{0, \pm 1, \pm 1/2\}$, then $\theta$ is not a rational multiple of $\pi$.

   For $n \neq 4$, both $\theta_1$ and $\theta_2$ are not rational multiples of $\pi$.

4. **Rearrange the quirky condition:**
   The condition $r_1 \theta_1 + r_2 \theta_2 + r_3 \theta_3 = 0$ can be rearranged to:
   \[
   (r_1 - r_3) \theta_1 + (r_2 - r_3) \theta_2 = -r_3 \pi
   \]
   If $r_1 = r_3$, then since $\theta_2$ is not a rational multiple of $\pi$, we must also have $r_2 = r_3$, leading to all $r_i$ being zero, which is a contradiction. Thus, $r_1 - r_3 \neq 0$ and $r_2 - r_3 \neq 0$.

5. **Consider the case when $r_3$ is even:**
   The condition implies:
   \[
   \cos(a \theta_1) = \cos(b \theta_2) \neq 0
   \]
   where $a = |r_1 - r_3| \geq 1$ and $b = |r_2 - r_3| \geq 1$ are positive integers.

6. **Express cosines in terms of sums:**
   \[
   \cos(a \theta_1) = \Re \left( \left( \frac{1}{2} \frac{n-4}{n-1} + i \frac{\sqrt{3}}{2} \frac{\sqrt{n^2-4}}{n-1} \right)^a \right)
   \]
   \[
   \cos(b \theta_2) = \Re \left( \left( \frac{1}{2} \frac{n+4}{n+1} + i \frac{\sqrt{3}}{2} \frac{\sqrt{n^2-4}}{n+1} \right)^b \right)
   \]

7. **Define sums $A$ and $B$:**
   \[
   A = \sum_{0 \leq k \leq a/2} \binom{a}{2k} \cdot (n-4)^{a-2k} \cdot (-3(n^2-4))^k
   \]
   \[
   B = \sum_{0 \leq \ell \leq b/2} \binom{b}{2\ell} \cdot (n+4)^{b-2\ell} \cdot (-3(n^2-4))^\ell
   \]

8. **Establish the boxed equation:**
   \[
   A \cdot 2^b (n+1)^b = B \cdot 2^a (n-1)^a
   \]

9. **Prove the claim about prime divisors:**
   **Claim:** All prime divisors of $n-1$ and $n+1$ are at most $3$.

   **Proof:** Suppose $p \mid n-1$ with $p \geq 5$. Then $p \nmid n+1$, $p \nmid 2$, and $a, b \geq 1$. By the boxed equation, $p \mid A$. Using $n \equiv 1 \pmod{p}$:
   \[
   A \equiv \sum_{0 \leq k \leq a/2} \binom{a}{2k} \cdot (-3)^{a-2k} \cdot (9)^k = (-3)^a \sum_{0 \leq k \leq a/2} \binom{a}{2k} = (-3)^a \cdot 2^{a-1} \pmod{p}
   \]
   which is nonzero as $p \geq 5$. This is a contradiction.

   Similarly, for $p \mid n+1$ with $p \geq 5$, we get:
   \[
   B \equiv \sum_{0 \leq \ell \leq b/2} \binom{b}{2\ell} \cdot (3)^{b-2\ell} \cdot (9)^\ell = 3^b \sum_{0 \leq \ell \leq b/2} \binom{b}{2\ell} = 3^b \cdot 2^{b-1} \pmod{p}
   \]
   which is nonzero as $p \geq 5$. This proves the claim. $\blacksquare$

10. **Handle the edge case $n = 17$:**
    **Claim:** We have $n \ne 17$.

    **Proof:** Suppose $n = 17$. Then:
    \[
    A = \sum_{0 \leq k \leq a/2} \binom{a}{2k} \cdot 13^{a-2k} \cdot (-855)^k
    \]
    \[
    B = \sum_{0 \leq \ell \leq b/2} \binom{b}{2\ell} \cdot 21^{b-2\ell} \cdot (-855)^\ell
    \]
    and:
    \[
    A \cdot 2^b \cdot 18^b = B \cdot 2^a \cdot 16^a
    \]
    so $v_3(B) \geq 2b$. Note that:
    \[
    B = 3^b \sum_{0 \leq \ell \leq b/2} \binom{b}{2\ell} \cdot 7^{b-2\ell} \cdot (-95)^\ell
    \]
    and:
    \[
    B / 3^b = \sum_{0 \leq \ell \leq b/2} \binom{b}{2\ell} \cdot 7^{b-2\ell} \cdot (-95)^\ell \equiv \sum_{0 \leq \ell \leq b/2} \binom{b}{2\ell} = 2^{b-1} \pmod{3}
    \]
    Thus, $v_3(B) = b$, which is a contradiction. $\blacksquare$

11. **Determine possible values of $n$:**
    **Claim:** We must have $n \in \{3, 5, 7\}$.

    **Proof:** If $n \geq 3$ and both $n-1$ and $n+1$ are of the form $2^x 3^y$, then $n \in \{3, 5, 7, 17\}$.

    **Case 1:** If $n$ is even, then $n-1$ and $n+1$ are both odd, so they are both powers of $3$. This can only happen for $n = 2$, which is too small.

    **Case 2:** If $n$ is odd, then one of $n-1, n+1$ is $2 \pmod{4}$ and the other is $0 \pmod{4}$, so:
    \[
    \{n+1, n-1\} = \{2 \cdot 3^a, 2^b \cdot 3^c\}
    \]
    for $b \geq 2$, and $a, c \geq 0$. Thus, $3^a$ and $2^{b-1} \cdot 3^c$ are consecutive, so one of $a$ or $c$ is $0$. If $a = 0$, then $2 \in \{n-1, n+1\}$, so $n = 3$.

    Now suppose that $c = 0$ and $a \geq 1$. In this case, $3^a$ and $2^{b-1}$ are consecutive. By Mihailescu's theorem, this can only happen for $(a, b) = (1, 2), (1, 3), (2, 4)$. These give the solutions $n = 5, 7, 17$ respectively. This completes the proof of the claim. $\blacksquare$

12. **Recap and verify quirky values:**
    We've shown that if $n$ is quirky, then $n \in \{3, 4, 5, 7\}$.

    If $n = 3$, we have $-\theta_1 + 2\theta_2 + \theta_3 = 0$.
    If $n = 4$, we have $-\theta_1 + \theta_2 + \theta_3 = 0$.
    If $n = 5$, we have $\theta_1 - 2\theta_2 = 0$.
    If $n = 7$, we have $2\theta_1 - 2\theta_2 - \theta_3 = 0$.

    This shows that $n = \boxed{3, 4, 5, 7}$ are quirky, completing the solution.