We say a nondegenerate triangle whose angles have measures $\theta_1$, $\theta_2$, $\theta_3$ is quirky 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. Evan Chen and Danielle Wang
Problem
Source: USA November TST for IMO 2021 and TST for EGMO 2021, Problem 3, by Evan Chen and Danielle Wang
Tags: TST, Niven theorem
16.11.2020 20:09
Let $\theta_1$ be the angle opposite the side $n+1$, $\theta_2$ opposite $n-1$, and $\theta_3$ opposite $n$. By calculation, we have \begin{align*} \cos\theta_1=\frac{n-4}{2(n-1)}&,\quad\sin\theta_1=\frac{\sqrt{3}}{2}\frac{\sqrt{n^2-4}}{n-1} \\ \cos\theta_1=\frac{n+4}{2(n+1)}&,\quad\sin\theta_1=\frac{\sqrt{3}}{2}\frac{\sqrt{n^2-4}}{n+1}.\end{align*}We have the following well known lemma. Lemma: If $\cos\theta\not\in\{0,\pm 1,\pm 1/2\}$, then $\theta$ is not a rational multiple of $\pi$. The lemma implies that as long as $n\ne 4$, both $\theta_1$ and $\theta_2$ are not rational multiples of $\pi$. Suppose now that $n\ne 4$, and that $n$ is quirky. The condition of the problem 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$, at which point plugging back in tells us all the $r_i$s are $0$, which can't be. Thus, $r_1-r_3\ne 0$, and similarly $r_2-r_3\ne 0$. If $r_3$ is odd, then scale up $(r_1,r_2,r_3)$ by a factor of $2$. So assume now that $r_3$ is even. The condition then implies that \[\cos(a\theta_1) = \cos(b\theta_2)\ne 0\]where $a=|r_1-r_3|\ge 1$ and $b=|r_2-r_3|\ge 1$ are positive integers. This cosine value is nonzero as both $\theta_1$ and $\theta_2$ are not rational multiples of $\pi$. We have \begin{align*} \cos(a\theta_1) &= \Re\left((\cos\theta_1+i\sin\theta_1)^a\right) \\ &= \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] \\ &= \frac{1}{2^a(n-1)^a}\sum_{0\le k\le a/2}\binom{a}{2k}\cdot(n-4)^{a-2k}\cdot(-3(n^2-4))^k. \end{align*}and \begin{align*} \cos(b\theta_2) &= \Re\left((\cos\theta_2+i\sin\theta_2)^b\right) \\ &= \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] \\ &= \frac{1}{2^b(n+1)^b}\sum_{0\le \ell\le b/2}\binom{b}{2\ell}\cdot(n+4)^{b-2\ell}\cdot(-3(n^2-4))^\ell. \end{align*}Let \begin{align*} A &= \sum_{0\le k\le a/2}\binom{a}{2k}\cdot(n-4)^{a-2k}\cdot(-3(n^2-4))^k \\ B &= \sum_{0\le \ell\le b/2}\binom{b}{2\ell}\cdot(n+4)^{b-2\ell}\cdot(-3(n^2-4))^\ell. \end{align*}Clearly, both $A$ and $B$ are integers, and they are nonzero since $\cos(a\theta_1)$ and $\cos(b\theta_2)$ are nonzero. We have \[\boxed{A\cdot 2^b(n+1)^b = B\cdot 2^a(n-1)^a}.\]The following claim is the heart of the solution. Claim: All prime divisors of $n-1$ and $n+1$ are at most $3$. Proof: Suppose to the contrary that we had a prime $p\mid n-1$ with $p\ge 5$. We see that $p\nmid n+1$, $p\nmid 2$, and $a,b\ge 1$, so by the boxed equation, $p\mid A$. However, using $n\equiv 1\pmod{p}$, we see that \begin{align*} A&\equiv \sum_{0\le k\le a/2}\binom{a}{2k}\cdot(-3)^{a-2k}\cdot(9)^k \\ &= (-3)^a\sum_{0\le k\le a/2}\binom{a}{2k} \\ &= (-3)^a\cdot 2^{a-1},\pmod{p} \end{align*}which is nonzero as $p\ge 5$. This is the desired contradiction. Suppose now that we had a prime $p\mid n+1$ with $p\ge 5$. We see that $p\nmid n-1$, $p\nmid 2$, and $a,b\ge 1$, so by the boxed equation, $p\mid B$. Using $n\equiv -1\pmod{p}$, we see that \begin{align*} B&\equiv \sum_{0\le \ell\le b/2}\binom{b}{2\ell}\cdot(3)^{b-2\ell}\cdot(9)^\ell \\ &= 3^b\sum_{0\le \ell\le b/2}\binom{b}{2\ell} \\ &= 3^b\cdot 2^{b-1},\pmod{p} \end{align*}which again is nonzero as $p\ge 5$. This proves the claim. $\blacksquare$ Unfortunately, we have to deal with one edge case by hand, which we do as part of the following claim. Claim: We have $n\ne 17$. Proof: Indeed, suppose $n=17$ worked. In this case, \begin{align*} A &= \sum_{0\le k\le a/2}\binom{a}{2k}\cdot 13^{a-2k}\cdot(-855)^k \\ B &= \sum_{0\le \ell\le b/2}\binom{b}{2\ell}\cdot 21^{b-2\ell}\cdot(-855)^\ell, \end{align*}and \[A\cdot 2^b\cdot 18^b = B\cdot 2^a\cdot 16^a,\]so $v_3(B)\ge 2b$. Note that \[B = 3^b\sum_{0\le \ell\le b/2}\binom{b}{2\ell}\cdot 7^{b-2\ell}\cdot(-95)^\ell,\]and \begin{align*} B/3^b &= \sum_{0\le \ell\le b/2}\binom{b}{2\ell}\cdot 7^{b-2\ell}\cdot(-95)^\ell \\ &\equiv \sum_{0\le \ell\le b/2}\binom{b}{2\ell} \\ &= 2^{b-1} \pmod{3}. \end{align*}Thus, $v_3(B)=b$, which is the desired contradiction. $\blacksquare$ We have the following busywork calculation. Claim: We must have $n\in\{3,5,7\}$. Proof: It suffices to prove that if $n\ge 3$ and both $n-1$ and $n+1$ are of the form $2^x3^y$, then $n\in\{3,5,7,17\}$. Case 1: Suppose $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: Suppose $n$ is odd. Then, one of $n-1,n+1$ is $2\pmod{4}$ and the other is $0\pmod{4}$, so we have \[\{n+1,n-1\} = \{2\cdot 3^a,2^b\cdot 3^c\}\]for $b\ge 2$, and $a,c\ge 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\ge 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$ To recap, 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.
16.11.2020 20:15
Well known fact that leading coefficient of kth Chebyshev polynomial is $2^{k-1}$ and the coefficient of $x^i $ is divisible by $2^{i -1}$. This comes from the recursion $C_k(x)=2xC_{k-1}(x)-C_{k-2}(x)$ If $C_k$ is the kth Chebyshev polynomial, then $C_a(\frac{n-4}{2(n-1)})=C_b(\frac{n+4}{2(n+1)})$ for some a and b. Thus, by bounding the denominator, we have 3 cases: 3|n where denominator of LHS is $2*(n-1)^a$ and denominator of RHS is $2*(n+1)^b$, note that since denominators are the same, we must have n-1 and n+1 powers of 2.(The leading term of LHS is $\frac{(n-4)^a}{2(n-1)^a}$ since $n-4,n-1$ are coprime and all other terms have smaller denominator, thus the entire fraction on LHS has denominator $2*(n-1)^a$ Similarly: n==1mod3 then (n-1)/3 and n+1 powers of 3 since the denominator of LHS is $2*(\frac{n-1}{3})^a$ and denominator of RHS is $2*(n+1)^b$ n==2mod3 then (n+1)/3 and n-1 powers of 3 since the denominator of RHS is $2*(\frac{n+1}{3})^b$ and denominator of LHS is $2*(n-1)^a$ n=4 is a special case since then n-4=0 This gives n=3,4,5,7 only possibilities and they all work.
16.11.2020 20:25
Similar to @above, except casework mod 4 instead of mod 3. Let $T_n^*$ be the $n$-th modified Chebyshev polynomial such that $T_n^*(2\cos\theta) = 2\cos n\theta$, which is well-known to be a monic integer polynomial. As above, if $n$ is quirky, $T_a^*\left(\frac{n-4}{n-1}\right) = T_b^*\left(\frac{n+4}{n+1}\right)$ for some $a,b$. If $n$ is even, $\gcd(n+1, n-1) = 1$, so both sides will be integers, so we reduce to Niven's theorem. This gives the $n=4$ solution. If $n$ is $1$ mod $4$, $\gcd(n+1, n-1) = 2$, and $\frac{n+1}{2}$ is odd. Let $\frac{n+4}{\frac{n+1}{2}} = \frac{a}{b}$ in lowest terms, so $b$ is odd, and $\gcd(b, n-1) = 1$. Then for $\nu_p$ reasons, we cannot have $p \mid b$ for any odd prime $b$, so in fact $b = 1$, giving $\frac{n+1}{2} \mid n+4 \implies n= 5$. If $n$ is $3$ mod $4$, identical work yields $n = 3, 7$
16.11.2020 21:56
willwin4sure wrote: We say a nondegenerate triangle whose angles have measures $\theta_1$, $\theta_2$, $\theta_3$ is quirky 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. Why do I think this has some connection with Linear Algebra?
16.11.2020 23:13
Note if $\theta_1,\theta_2$ are both (rational) multiples of $\pi$, as the value of their cosine is either $0,\pm 1,\pm\frac 12$. We can check that we can choose the order such that \[\cos\theta_1=\frac{n-4}{2(n-1)},\cos\theta_2=\frac{n+4}{2(n+1)}\]In particular, the second one is never one but is greater than $\frac 12$, and the first one is positive but less than $\frac 12$ for $n\geq 5$, so we can assume $n\geq 5$ and neither are multiples of $\pi$. In particular, we get that \[x\theta_1+y\theta_2=2z\pi\]where $x=2(r_1-r_2),y=2(r_2-r_3),z=-r_3$ are all integers. Furthermore, we note that $x,y\neq 0$, as otherwise, either $\theta_1$ or $\theta_2$ is a rational multiple of $\pi$. Thus, we get \[\cos(x\theta_1)=\cos(y\theta_2)\]or equivalently \[T_x\left(\frac{n-4}{2(n-1)}\right)=T_y\left(\frac{n+4}{2(n+1)}\right)\]Note if $n\equiv 0\pmod 3$, the $\gcd(n-4,n-1)=\gcd(n+4,n+1)=1$. Let $p>3$ be a prime dividing $n-1$ with multiplicity $k$. Then the value of $\nu_p\left[T_x\left(\frac{n-4}{2(n-1)}\right)\right]$ is $-xk$ (as $p\neq 2$ so the leading coefficient $2^{x-1}$ can not cancel out with the denominator), while the right hand side has value $\geq 0$, a contradiction. Thus, we must have $n-1,n+1$ powers of $2$ so $n=3$. If $n\equiv 1\pmod 3$, we get by the same analysis, $\frac{n-1}3$ and $n+1$ are powers of $2$, giving $n=7$. This can be noted, as \[\frac{n+1}2>\frac{n-1}3>\frac{n+1}8\implies\frac{n-1}3=\frac{n+1}4\implies n=7\](remember we assume $n\geq 5$. Similarly, if $n\equiv 2\pmod 3$, $\frac{n+1}3$ and $n-1$ are powers of $2$, giving $n=5$. This can be similarly noted, as \[n-1\frac{n+1}3>\frac{n-1}4\]so thus $\frac{n+1}3=\frac{n-1}2$ and $n=5$. We can check these indeed work, which is left to the reader as I am extremely lazy.
17.11.2020 04:28
Arabian_Math wrote: Why do I think this has some connection with Linear Algebra? Only superficially. You can phrase it as saying that the angles are linearly dependent over $\mathbb Q$. But I do not see a reason to believe this interpretation allows for any new approaches (though it may help with the intuition in some of the manipulations that appear earlier).
18.11.2020 05:24
Does someone have a proof of the fact about cosines of rational multiples of $ \pi $?
18.11.2020 10:11
shalomrav wrote: Does someone have a proof of the fact about cosines of rational multiples of $ \pi $? It is called Niven's theorem. I like the proof given here best, but it uses algebraic number theory.
18.11.2020 19:16
v_Enhance wrote: shalomrav wrote: Does someone have a proof of the fact about cosines of rational multiples of $ \pi $? It is called Niven's theorem. I like the proof given here best, but it uses algebraic number theory. Thank you evan. Very nice proof!
22.02.2021 04:40
Solved with nukelauncher. The answers are 3, 4, 5, 7, which we will prove work at the end of this proof. First we will prove that no other \(n\) work. Let \(\theta_1\), \(\theta_2\), \(\theta_3\) be opposite the sides of length \(n\), \(n+1\), \(n-1\), respectively. Then it is not hard to determine that \[\cos\theta_2=\frac{n-4}{2(n-1)}\quad\text{and}\quad\cos\theta_3=\frac{n+4}{2(n+1)}.\] Doubling, subtracting off \(2r_1(\theta_1+\theta_2+\theta_3)=0\) from, and clearing denominators from the given condition, we find that a triangle is quirky if and only if there exist integers \(r_2\), \(r_3\) obeying \[r_2\theta_2\equiv r_3\theta_3\pmod{2\pi}.\]In other words, if \(T_k\) denotes the \(k\)th Chebyshev polynomial, \[T_{r_2}\left(\frac{n-4}{2(n-1)}\right)=T_{r_3}\left(\frac{n+4}{2(n+1)}\right).\tag{\(*\)}\] Assume \(n\ge6\) (in particular, \(n-4\ne0\)). Recall that the leading coefficient of \(T_r\) is a power of two for each \(r\), so for all odd primes \(p\), \[\nu_p(T_r(x))\ge0\quad\text{if and only if}\quad\nu_p(x)\ge0.\tag{\(\star\)}\] Claim: If \(n\ge6\), then the only primes that divide \(n-1\) and \(n+1\) are 2 and 3. Proof. If \(p\) is odd and \(p\mid n-1\), then \(\nu_p(\frac{n-4}{2(n-1)})<0\) but \(\nu_p(\frac{n+4}{2(n+1)})\ge0\), so the two expressions in \((*)\) have different \(\nu_p\) by \((\star)\), contradiction. An analogous argument holds for \(p\mid n+1\). \(\blacksquare\) Claim: If \(n\ge6\), then \(n\in\{7,17\}\) Proof. By the first claim, \(n-1\) and \(n+1\) are of the form \(2^\alpha3^\beta\). But \(\gcd(n-1,n+1)\in\{1,2\}\), so there are five cases: \((n-1,n+1)=(3^a,3^b)\): this is only possible for \((a,b)=(0,1)\), i.e.\ \(n=2\). \((n-1,n+1)=(2^{a+1}\cdot3^b,2)\): there is no solution. \((n-1,n+1)=(2,2^{a+1}\cdot3^b)\): it readily follows that \(n=3\). \((n-1,n+1)=(2\cdot3^b,2^{a+1})\): then \(2^a-3^b=1\), which gives \(b=0,1\) and thus \(n=3,7\) by Mihăilescu theorem. \((n-1,n+1)=(2^{a+1},2\cdot3^b)\): then \(3^b-2^a=1\), which gives \(a=1,3\) and thus \(n=5,17\) by Mihăilescu theorem. \(\blacksquare\) Finally, we will check which of \(n=3,4,5,7,17\) satisfy \((*)\): \(n=3\) works since \(T_4(\frac{-1}4)=T_2(\frac78)\). \(n=4\) works by common sense. \(n=5\) works since one angle is double the other. \(n=7\) works since \(T_6(\frac14)=T_2(\frac{11}{16})\). \(n=17\) fails by taking \(\nu_3\) in \(T_{r_2}(\frac{13}{32})=T_{r_3}(\frac7{12})\): since \(\nu_3(\frac{13}{32})\ge0\) and \(\nu_3(\frac7{12})<0\), the two sides have different \(\nu_3\) by \((\star)\).
20.01.2022 07:25
Solved with rama1728. Let $T_k$ be the $k$th Chebyshev polynomial. Define the polynomial $P_k = 2T_k(x/2),$ so $P_k(2\cos(x)) = 2\cos(kx).$ Note $P_0(x) = 1,$ $P_1(x) = x,$ and the recursive relation $P_k(x) = x P_{k-1}(x) - P_{k-2}(x).$ So $P_k$ is a monic integer polynomial. Let $\theta_1$ be opposite $n+1$ and $\theta_2$ opposite $n-1.$ Note $$r_1\theta_1+r_2\theta_2+r_3\theta_3=0 \iff (r_1-r_3) \theta_1 = (r_3 - r_2)\theta_2 - \pi r_3$$so it is necessary and sufficient for there to exist nonnegative integers $l, m$ (not both $0$) where $$P_l(2\cos(\theta_1)) = \pm P_m(2\cos(\theta_2)) \iff P_l\left(\frac{n-4}{n-1} \right) = \pm P_m \left(\frac{n+4}{n+1} \right)$$by Law of Cosines. If $l = 0,$ then $\frac{n+4}{n+1}$ is an integer by Rational Root Theorem, so $n = 2.$ We discard this. Similarly, if $m = 0,$ then $\frac{n-4}{n-1}$ is an integer so $\boxed{n = 4.}$ This works due to the $3-4-5$ right triangle. If $l, m > 0,$ let $\frac{n-4}{n-1} = \frac{p}{q}$ and $\frac{n+4}{n+1} = \frac{r}{s}$ for any integers $p,q,r,s.$ Then $$P_l\left(\frac{p}{q} \right) = \left(\frac{p}{q} \right)^l + a_1\left( \frac{p}{q} \right)^{l-1} + \dots + a_l$$and $$P_m \left(\frac{r}{s} \right) = \left(\frac{r}{s} \right)^m + b_1\left( \frac{r}{s} \right)^{m-1} + \dots + b_m.$$for integers $a_1, \dots , a_l$ and $b_1, \dots , b_m.$ Multiplying both expressions by $q^l s^m$ and equating their magnitudes yields any prime dividing $q$ divides $ps$ and any prime dividing $s$ divides $rq.$ Setting $p,q,r,s$ as $n-4,n-1,n+4,n+1$ respectively yields any prime dividing $n-1$ or $n+1$ divides $6.$ It's easy to verify the only $n$ satisfying this property are $n=3,5,7,17.$ $n=17$ doesn't work because setting $p,q,r,s$ as $13, 16, 7, 6$ respectively yields contradiction because $3 \nmid 16 \times 7.$ For the remaining constructions, verify $P_1(x) = x, P_2(x) = x^2-2, P_3(x) = x^3-3x.$ $\boxed{n=7}$ works since $P_3\left(\frac{7-4}{7-1}\right) = -\frac{11}{8} = -P_1\left(\frac{7+4}{7+1} \right).$ $\boxed{n=5}$ works since $P_2\left(\frac{5+4}{5+1}\right) = \frac{1}{4} = P_1\left(\frac{5-4}{5-1} \right).$ $\boxed{n=3}$ works since $P_2\left(\frac{3-4}{3-1}\right) = -\frac{7}{4} = -P_1\left(\frac{3+4}{3+1} \right).$ So $n$ works iff $\boxed{n \in \{3,4,5,7\}.}$ $\blacksquare$
30.09.2023 22:39
The answer is $n \in \{3,4,5,7\}$. Let $\theta_1$ be opposite the side of length $n+1$ and $\theta_2$ be opposite the side of length $n-1$. We can calculate $$\cos \theta_1=\frac{n-4}{2n-2} \text{ and } \cos \theta_2=\frac{n+4}{2n+2}.$$It suffices to find all $n$ for which there exist even integers $r_1,r_2,r_3$ such that the above expression equals zero. Observe that $$r_3(\pi-\theta_1-\theta_2)+r_1\theta_1+r_2\theta_2=0 \iff (r_3-r_1)\theta_1+(r_3-r_2)\theta_2=r_3\pi,$$so it is necessary and sufficient for there to exist integers $a',b'$ such that $a'\theta_1 \equiv b'\theta_2 \pmod{2\pi}$, whence $\cos a'\theta_1=\cos |a'|\theta_1=\cos |b'|\theta_2=\cos b'\theta_2$. Letting $T_k$ denote the $k$-th Chebyshev polynomial and taking $a,b=|a'|,|b'|$, this implies that there exist $a,b \geq 0$ such that $$T_a\left(\frac{n-4}{2n-2}\right)=T_b\left(\frac{n+4}{2n+2}\right).$$Note that the leading coefficient of $T_k$ is $2^k$, so if we can find some odd prime $p$ such that exactly one of $\nu_p(\tfrac{n-4}{2n-2})$ and $\nu_p(\tfrac{n+4}{2n+2})$ is negative, we are done. Claim: The only $n \geq 3$ where no such $p$ exists are $n \in \{3,4,5,7\}$. Proof: Since $\gcd(2n-2,2n+2) \mid 4$ and $\gcd(2n-2,n-4),\gcd(2n+2,n+4) \mid 6$, if no such prime exists then the only primes dividing $2n-2$ and $2n+2$ are $2$ or $3$, so we wish to find all $n$ for which $n-1$ and $n+1$ only have prime factors $2,3$. Clearly $n=3,4$ work; if $n \geq 4$, then $n$ must be odd, so since one of $n-1$ and $n+1$ is not divisible by $3$, one of them must be a power of $2$. On the other hand, by Zsigmondy's theorem $2^k-2$ always has some odd prime divisor other than $3$ unless $k=2,3$, so if $n+1$ is a power of $2$ then $n=7$, and $2^k+2$ always has some odd prime divisor other than $3$ unless $k=2,4$, so if $n-1$ is a power of $2$ then $n=5,17$. But $17$ doesn't work, since $\nu_3(\tfrac{n+4}{2n+2})=\nu_3(\tfrac{21}{36})<0$ while $\nu_3(\tfrac{n-4}{2n-2})=0$. $\blacksquare$ It now suffices to check that $3,4,5,7$ work. Indeed, For $n=3$, $T_4(\tfrac{-1}{4})=T_2(\tfrac{7}{8})$, For $n=4$, the triangle is right, so $(r_1,r_2,r_3)=(1,-1,-1)$ will work, For $n=5$, $T_1(\tfrac{1}{8})=T_2(\tfrac{3}{4})$, For $n=7$, $T_6(\tfrac{1}{4})=T_2(\tfrac{11}{16})$, so we are done. $\blacksquare$ Remark: The last step can be made easier by noting that if $|T_a(m)|=|T_b(n)|$ then $T_{2a}(m)=T_{2b}(n)$, which is what I did. Of course, there is no need to write this down in the actual solution.
15.04.2024 03:20
Solved with brainfertilzer. The answer is $\boxed{3,4,5,7}$. As we solve the problem, always WLOG assume that $\theta_1$ is opposite the side with length $n - 1$ and $\theta_3$ is opposite the side with length $n + 1$. Claim: A triangle (with angle measures $\theta_1, \theta_2, \theta_3$) is quirky iff there exist integers $a,b$ that aren't both zero such that \[ a \theta_1 + b \theta_3 = 0 \pmod{\pi} \]Proof: If such integers $a,b$ exist, let $a \theta_1 + b \theta_3 = \pi \cdot r_2$, and then $r_1 = r_2 - a, r_3 = r_2 - b$. We have \[ r_1 \theta_1 + r_2 \theta_2 + r_3 \theta_3 = r_2(\theta_1 + \theta_2 + \theta_3) - (a \theta_1 + b \theta_3) = r_2 \pi - (a \theta_1 + b\theta_3) = 0\]and clearly $r_1, r_2, r_3$ aren't all zero. Now for the other direction, let $a = r_1 - r_2$ and $b = r_3 - r_2$. We have \[ a \theta_1 + b \theta_3 = r_1 \theta_1 + r_3 \theta_3 - r_2(\theta_1 + \theta_3) = r_1 \theta_1 + r_3 \theta_3 - r_2( \pi - \theta_2) = - r_2 \pi \]$\square$ In fact, this is equivalent to there existing integers $a,b$ satisfying \[ \cos (a \theta_1) = \pm \cos (b \theta_3) \] By Law of Cosines, we have $(n+1)^2 + n^2 - 2n (n+1) \cos (\theta_1) = (n-1)^2$, so $\cos(\theta_1) = \frac{n+4}{2n + 2}$. Similarly, $\cos(\theta_3) = \frac{n-4}{2n - 2}$. Now we prove that $n = 3,4,5,7$ work.
It suffices to show $n\in \{3,4,5,7\}$. Assume that $n$ isn't in this set (in particular, $n > 5$). Let $p_a(x)$ denote the $a$th Chebyshev polynomial. In particular, $p_a(\cos x) = \cos(a\cdot x) $. We have \[ p_a \left( \frac{ n+4}{2n + 2} \right) = \pm \ p_b \left( \frac{ n-4}{2n - 2} \right) \ \ \ \ \ \ \ \ \ \ \ (1) \] Additionally, $p_a(x)$ is an integer polynomial of degree $a$ and leading coefficient $2^{a-1} $, and similarly $p_b(x)$ is an integer polynomial of degree $b$ and leading coefficient $2^{b-1}$. Claim: Both $a$ and $b$ are nonzero. Proof: Suppose otherwise. If $a=0$, then $\theta_3$ is a rational multiple of $\pi$ and $\cos(\theta_3) = \frac{n-4}{2n-2} $ is rational, so by Niven's Theorem, $\cos(\theta_3) = \frac{n-4}{2n-2}\in \left \{ -1, - \frac 12 , 0, \frac 12, 1\right \} $. Since degenerate triangles are not allowed, $\theta_3$ cannot be $0$ or $\pi$, meaning that its cosine cannot be $-1$ or $1$. Now, since $n > 4$, $\frac{n-4}{2n-2} > 0$, so it must equal $\frac 12$, but then $2(n-4) = 2n-2$ is clearly impossible. If $b = 0$, then $\theta_1$ is a rational multiple of $\pi$ and $\cos(\theta_1) = \frac{n+4}{2n + 2}$ is rational, so by Niven's Theorem, $\cos(\theta_1) = \frac{n+4}{2n + 2 } \in \left \{ -1 , - \frac 12 , 0 , \frac 12 , 1 \right\}$. Since $\theta$ can't be $0$ or $\pi$, and clearly $\cos(\theta) > 0$, we must have $\cos(\theta) = \frac 12$, contradiction since $2(n+4) \ne 2n +2$. $\square$ Claim: The value of $(n-1)(n+1)$ cannot have a prime factor larger than $3$. Proof: In $(1)$, multiply both sides by $(2n + 2)^a \cdot (2n - 2)^b$. The new equation is \[ (2n+2)^a (2n-2)^b p_a \left( \frac{n+4}{2n + 2} \right) = \pm (2n + 2)^a (2n-2)^b p_b \left( \frac{n-4}{2n - 2} \right) \ \ \ \ \ \ \ \ \ \ \ \ (2) \]Notice that both sides become integers. Now let $p$ be a prime dividing $2n + 2$. Notice that $(2n-2)^b p_b \left( \frac{n-4}{2n-2} \right) $ is an integer (as the denominator of the terms in the polynomial divide $(2n-2)^b$), so the RHS of $(2)$ is $0\pmod p$ (since $a > 0$). Now, all terms of $p_a\left( \frac{n+4}{2n+2} \right)$ that aren't the leading term (as in terms of $p_a(x)$ evaluated at $\frac{n+4}{2n+2}$) yield something divisible by $2n+2$ when multiplied by $(2n+2)^a (2n-2)^b$. Since the leading term of $p_a\left( \frac{n+4}{2n+2} \right) $ is $2^{a-1} \cdot \frac{(n+4)^a}{(2n+2)^a}$, we see that the LHS is $2^{a-1} \cdot (n+4)^a (2n-2)^b $ modulo $p$. Since the RHS is $0\pmod p$, the LHS must also be, so $p\mid 2^{a-1} (n+4)^a (2n-2)^b$, hence $p = 2$, $p\mid n + 4$, or $p\mid 2n - 2$. If $p\mid n + 4$, then $p\mid 2(n+4) - (2n+2) = 6$ and if $p\mid 2n - 2$, then $p \mid (2n+2) - (2n-2) = 4$, so $p\in \{2,3\}$. Now let $q$ be a prime dividing $2n - 2$. We see that $(2n+2)^a p_a \left( \frac{n+4}{2n+2} \right)$ is an integer, so the LHS of $(2)$ is $0\pmod q$ (since $b > 0$). Similarly, all terms of $p_b \left( \frac{n-4}{2n-2} \right)$ that aren't the leading term yield something divisible by $2n - 2$ when multiplied by $(2n+2)^a (2n-2)^b$. Since leading term of $p_b \left( \frac{n-4}{2n-2} \right)$ is $2^{b-1} \frac{(n-4)^b }{(2n-2)^b} $, we see that the RHS is $2^{b-1} \cdot (n-4)^b \cdot (2n+2)^a $ modulo $q$. Since the LHS is $0\pmod q$, the RHS is also $0\pmod p$, so $q$ either divides $2, n-4, $ or $2n + 2$. If $q\mid 2$, then $q = 2$. If $q\mid n - 4$, then $q\mid (2n-2) - 2(n-4) = 6$. If $q\mid 2n + 2$, then $q\mid (2n+2) - (2n-2) = 4$. Hence $q\in \{2,3\}$. Therefore, every prime divisor of $2n + 2$ and $2n - 2$ must be $2$ or $3$, so every prime divisor of $\frac{(2n-2)(2n+2)}{4} = (n-1)(n+1)$ must also be $2$ or $3$. $\square$ Claim: $n$ is odd. Proof: If $n$ was even, then $n-1$ and $n+1$ are powers of $3$, so $n = 2$, absurd. $\square$ Now notice that $n - 1$ and $n + 1$ are greater than $1$ and one of them is not a multiple of $3$, so one of $n-1, n + 1$ is a power of $2$. This power of $2$ must be at least $4$ (since $n > 3$), so the other number in $\{n-1,n+1\}$ is $2$ times a power of $3$. Hence if $n = 2k + 1$, then one of $k, k+1$ is a power of $2$, and the other is a power of $3$. Since $n\not\in \{3,5,7\}$, we have $k > 3$. Thus, $k, k+1$ are perfect powers, so we must have $k = 8, k + 1 = 9$ by Mihailescu's Theorem. Hence $n = 17$. We may now rewrite $(1)$ as $p_a \left( \frac{7}{12} \right) = \pm \ p_b \left( \frac{13}{32} \right)$. Now multiply both sides by $12^a \cdot 32^b$. We see that the RHS becomes $\pm \ 32 p_b \left( \frac{13}{32} \right) \cdot 12^a$, which is an integer times $12^a$, so it is $0\pmod 3$. Now, the only term in the LHS that doesn't necessarily yield a multiple of $3$ after being multiplied by $12^a$ is the leading term, which yields $2^{a-1} \cdot \left( \frac{7}{12} \right)^a \cdot 12^a \cdot 32^a$, so the LHS becomes $2^{a-1} \cdot 7^a \cdot 32^a \not \equiv 0\pmod 3$, contradiction. So $n = 17$ doesn't work. Thus, we can conclude that $n\in \{3,4,5,7\}$.