AIME 2026 II · 第 14 题
AIME 2026 II — Problem 14
题目详情
Problem
For integers and , let if is odd and is even, and otherwise. Find the number of sequences of positive integers such that
where the operations are performed from left to right; that is, means .
解析
Solution 1
Let be the sum of all terms added when evaluating the operation, and be the sum of all terms subtracted. Every term in the sequence is either added or subtracted, so the total sequence sum is:
The final operation result equals the sum of added terms minus the sum of subtracted terms:
We have the system:
Adding the two equations gives: . We substitute back to get . Thus, the sum of all subtracted terms in the operation must be exactly . Our problem reduces to counting sequences where the total of subtracted terms equals . We know for any integers and , . Subtraction does not change the parity of the result. By induction on the number of terms, the parity of the running operation result before term is exactly equal to the parity of the sum of all terms before . This gives a simplified subtraction rule, a term is subtracted if and only if:
- The sum of all terms before is odd;
- itself is even.
Even terms do not change the parity of the cumulative sum, only odd terms do. This allows us to partition the sequence into "gaps" of even terms between (and before/after) the odd terms, eliminating the need to track running parity for every term. Suppose a sequence has odd terms, in order: . We split the sequence into gaps of even terms: : Even terms before the first odd term ; : Even terms between and for ; : Even terms after the last odd term . All even terms in the sequence fall into exactly one of these gaps. For example, in the sequence : Odd terms: , so , Gaps: , , . The parity of the cumulative sum before gap depends only on the number of odd terms we have already passed: Before : odd terms sum parity is even; Before : odd term sum parity is odd; Before : odd terms sum parity is even; In general: Before , sum parity is . Combined with our subtraction rule, this gives: All even terms in odd-indexed gaps () are subtracted. All even terms in even-indexed gaps () are added. Now our counting goal is to count sequences where the sum of even terms in odd-indexed gaps equals . We split the total sequence sum into three non-negative parts:
- : Sum of the odd terms in the sequence
- : Sum of even terms in even-indexed gaps (added terms)
- : Sum of even terms in odd-indexed gaps (subtracted terms, which equals )
From the total sequence sum:
We now find all valid values of :
- is the sum of positive odd terms. Recall that the sum of odd numbers is even if and only if there is an even number of terms, since odd + odd = even, and pairs of odd terms preserve evenness.
- is a sum of even terms, so it is even.
- , so must be even.
- is impossible: no odd terms means no odd-indexed gaps, so .
- is impossible: cannot be negative.
Thus, the only valid values for are . We now count valid sequences for each value of , breaking our work into subcases for clarity. We will use two main counting rules for our analysis:
- Compositions: A composition of a number is an ordered sum of positive integers. For example, and are distinct compositions of , since sequence order matters.
- Splitting Even Sums Across Gaps: To split an even sum across gaps, we allow empty gaps: Let the sum in gap be , so , which can be counted using the stars and bars method. For a gap with : exactly way (no terms). For a gap with : the number of compositions of into positive even terms is , since we double each part of a composition of to get an even composition.
Case 1: Sum of Odd Terms Here, : no even terms in even-indexed gaps. We count:
- Number of compositions of into an even number of positive odd terms
- Number of ways to split the subtracted sum into the odd-indexed gaps
Subcase 1a: 2 odd terms Compositions of into 2 odd terms: ways Number of odd-indexed gaps: () Ways to split into 1 gap: ways. To see this, note the even compositions of 6 are , , , and , giving exactly 4 ways.
Total:
Subcase 1b: 4 odd terms Compositions of into 4 odd terms: ways Number of odd-indexed gaps: () Ways to split into 2 gaps: ways
Total:
Subcase 1c: 6 odd terms Compositions of into 6 odd terms: way Number of odd-indexed gaps: () Ways to split into 3 gaps: ways
Total:
Total for Case :
Case 2: Sum of Odd Terms Here, : we split extra even terms across even-indexed gaps. We count:
- Number of compositions of into an even number of positive odd terms
- Number of ways to split the subtracted sum into odd-indexed gaps
- Number of ways to split the added sum into even-indexed gaps
Subcase 2a: 2 odd terms Compositions of into 2 odd terms: ways Odd-indexed gaps: ways to split Even-indexed gaps: () ways to split
Total:
Subcase 2b: 4 odd terms Compositions of into 4 odd terms: way Odd-indexed gaps: ways to split Even-indexed gaps: () ways to split
Total:
Total for Case :
Case 3: Sum of Odd Terms Here, : we split extra even terms across even-indexed gaps. It is only possible to have 2 odd terms. Compositions of into 2 odd terms: way Odd-indexed gaps: ways to split Even-indexed gaps: ways to split More than odd terms is impossible, as the smallest sum of 4 positive odd terms is , which is greater than .
Total for Case :
We add the totals from all valid cases:
Hence, the number of valid sequences is .
~Steven Zheng
Solution 2
Since the sum is even, the count of odd numbers is even, let it be . We can rewrite the sequence as:
where o stands for odd and e stands for even. Denote
and we can notice that:
From which we can deduce:
which we see , so let's starting counting.
: The number of even sequences summing up to is , this can be proven easily using stars and bars.
We denote as under a fixed , the count of possible sequences summing up to .
as the count of possible sequence summing up to .
as the count of possible sequences summing up to .
Then the sought answer can be expressed as:
And we can find each component individually.
First, by stars and bars, is just .
Finding is also simple. When , is clearly . and when , is always , which leaves us with , possible sequences are and , so .
Lastly, we calculate . is simply .
There are 2 cases for : or with their permutations.
For the first case, we have permutations, along with sequences. For the second case, we also have permutations along with sequences. Summing up:
There are 3 cases for : or with their permutations.
For the first case, we have permutations, along with sequences. For the second case, we have permutations along with sequences. For the third case, we have permutations and sequence. Summing up:
Substituting back and we can finally get our answer:
~PikaBlaze (feel free to edit)
Solution 3
We begin by analyzing the parity of the partial sums resulting from the operation . Let denote the result of the operations on the prefix . That is, and for . The operation is defined as:
Observe that in both cases, . By induction, the parity of the partial result is equal to the parity of the sum of the terms:
This observation is crucial because the condition for subtraction depends on the parity of the previous result.
Specifically, the term (for ) is subtracted if and only if is odd and is even. In all other cases, is added.
Since , we can state the rule solely in terms of the sum of the preceding terms: is subtracted if and only if the sum of the previous terms is odd and itself is even.
Let be the set of indices such that is added, and be the set of indices such that is subtracted. The value of the expression is given by:
We are given two conditions: the total sum of the integers is , and the result of the operations is . Substituting the total sum into the expression for :
Setting yields , which implies:
Thus, the problem is equivalent to finding the number of sequences of positive integers with a total sum of 12 such that the sum of the terms is exactly 6.
We can solve this using dynamic programming. Let be the number of sequences of positive integers with total sum where the sum of the subtracted terms is . We are interested in finding .
The state transitions depend on whether the current accumulated sum is even or odd, as this determines whether the next term will be subtracted.
\begin{array}{|c|c|c|c|} \hline \text{Current Sum } s & \text{Last Term } v & \text{Prev Sum } s-v & \text{Action on } v \\ \hline \text{Even} & \text{Even} & \text{Even} & \text{Add} \\ \text{Even} & \text{Odd} & \text{Odd} & \text{Add} \\ \hline \text{Odd} & \text{Odd} & \text{Even} & \text{Add} \\ \textbf{Odd} & \textbf{Even} & \textbf{Odd} & \textbf{Subtract} \\ \hline \end{array}
Let's derive the recurrence relations for by considering the last term added, say . The previous sum was .
If the current sum is even:
The previous sum must have the same parity as .
If is even, is even. The previous sum was even, so was added (not subtracted).
If is odd, is odd. An odd term is never subtracted.
In both cases, no subtraction occurred for the last term. Thus:
. If the current sum is odd:
The previous sum must have the opposite parity to .
If is odd, is even. The previous sum was even, so was added.
If is even, is odd. The previous sum was odd and is even, so was \textbf{subtracted}. The previous subtracted sum must have been .
Thus:
We compute for from 1 to 12. The base case is (the empty sequence). We require .
Performing the calculation step-by-step:
(Odd): .
(Even): .
(Odd):
- : Add 1 to , add 3 to . .
- : Add 2 (sub) to . .
.
(Even):
- : Sum all for . .
- : Sum all for . .
.
(Odd):
- : Add odd to and ; add even (sub) to .
- odd: (from ) + (from ) = .
- even: Add 2 (sub) to . Add 4 (sub) to .
- Total for : .
- : Add 2 (sub) to . Total 1.
. (Other values omitted for brevity).
Continuing this process systematically up to and :
At , we sum the contributions to reach a subtracted sum of .
The total count is found to be exactly .
~ By Jesse Zhang (FUNKCCP)List of Valid Sequences
The all 157 possible sequences:
111112221, 11111241, 11111421, 1111161, 111211221, 11121141, 111221121, 111222111, 11122212, 1112223, 11124111, 1112412, 111243, 11141121, 11142111, 1114212, 111423, 1116111, 111612, 11163, 11212221, 1121241, 1121421, 112161, 1132221, 113241, 113421, 11361, 121111221, 12111141, 121121121, 121122111, 12112212, 1211223, 12114111, 1211412, 121143, 12121221, 1212141, 1213221, 121341, 122111121, 122112111, 12211212, 1221123, 12212121, 1221321, 122211111, 12221112, 1222113, 12221211, 1222122, 1222131, 122214, 1222311, 122232, 12225, 1223121, 1231221, 123141, 12411111, 1241112, 124113, 1241211, 124122, 124131, 12414, 124311, 12432, 1245, 1312221, 131241, 131421, 13161, 14111121, 14112111, 1411212, 141123, 1412121, 141321, 14211111, 1421112, 142113, 1421211, 142122, 142131, 14214, 142311, 14232, 1425, 143121, 1611111, 161112, 16113, 161211, 16122, 16131, 1614, 16311, 1632, 165, 21112221, 2111241, 2111421, 211161, 21211221, 2121141, 21221121, 21222111, 2122212, 212223, 2124111, 212412, 21243, 2141121, 2142111, 214212, 21423, 216111, 21612, 2163, 2212221, 221241, 221421, 22161, 232221, 23241, 23421, 2361, 3112221, 311241, 311421, 31161, 3211221, 321141, 3221121, 3222111, 322212, 32223, 324111, 32412, 3243, 341121, 342111, 34212, 3423, 36111, 3612, 363, 412221, 41241, 41421, 4161, 52221, 5241, 5421, 561