Skip to main content

2026 AIME II Problem 14

Problem 14 of 15HarderAlgebraNumber TheoryCombinatoricsProblem-Solving Techniques

For integers aa and b,b, let a∘b=a−ba \circ b = a - b if aa is odd and bb is even, and a∘b=a+ba \circ b = a + b otherwise. Find the number of sequences a1,a_1, a2,a_2, a3,a_3, …,\ldots, ana_n of positive integers such that a1+a2+a3+⋯+an=12a_1 + a_2 + a_3 + \cdots + a_n = 12 and a1∘a2∘a3∘⋯∘an=0,a_1 \circ a_2 \circ a_3 \circ \cdots \circ a_n = 0, where the operations are performed from left to right; that is, a1∘a2∘a3a_1 \circ a_2 \circ a_3 means (a1∘a2)∘a3.(a_1 \circ a_2) \circ a_3.

Your answer

Integer from 0 to 999
Show solution

Solution

Since a−b≡a+b(mod2),a - b \equiv a + b \pmod 2, the running value after kk steps has the same parity as a1+⋯+ak.a_1 + \cdots + a_k. So term aka_k is subtracted exactly when aka_k is even and the prefix sum a1+⋯+ak−1a_1 + \cdots + a_{k-1} is odd, and the final value is 1212 minus twice the total of the subtracted terms. We must count compositions of 1212 in which the even terms sitting where the prefix sum is odd total exactly 6.6. The prefix parity flips exactly at odd terms, so the odd terms come in 2m2m (the total is even), and the subtracted terms are precisely the even terms lying between the (2i−1)(2i-1)st and 2i2ith odd terms; these mm “odd stretches” must hold even terms totaling 6,6, while the other m+1m + 1 stretches hold even terms totaling 6−A,6 - A, where AA is the sum of the odd terms. Let fr(t)f_r(t) be the number of ways to fill rr ordered stretches with sequences of even terms totaling 2t.2t. One stretch is a composition of 2t2t into even parts, i.e. of t:t: f1(t)=2t−1f_1(t) = 2^{t-1} for t≥1t \ge 1 and f1(0)=1;f_1(0) = 1; convolving gives the values needed below: fr(0)=1,f_r(0) = 1, fr(1)=r,f_r(1) = r, f2(2)=5,f_2(2) = 5, and f1(3),f2(3),f3(3)=4,12,25.f_1(3), f_2(3), f_3(3) = 4, 12, 25. Compositions of AA into 2m2m odd parts number (A−2m2+2m−12m−1).\binom{\frac{A - 2m}{2} + 2m - 1}{2m - 1}. Casework on mm and A:A: for m=1:m = 1: A=2,4,6A = 2, 4, 6 give 1⋅4⋅f2(2)=20,1 \cdot 4 \cdot f_2(2) = 20, 2⋅4⋅f2(1)=16,2 \cdot 4 \cdot f_2(1) = 16, and 3⋅4⋅1=12.3 \cdot 4 \cdot 1 = 12. For m=2:m = 2: A=4,6A = 4, 6 give 1⋅12⋅f3(1)=361 \cdot 12 \cdot f_3(1) = 36 and 4⋅12⋅1=48.4 \cdot 12 \cdot 1 = 48. For m=3:m = 3: A=6A = 6 gives 1⋅25⋅1=25.1 \cdot 25 \cdot 1 = 25. The total is 20+16+12+3620 + 16 + 12 + 36 +48+25=157.+ 48 + 25 = 157.
AoPS wiki

Tagged: custom operation · partitions and compositions · parity · casework

More practice