{
  "index": "2023-A-6",
  "type": "COMB",
  "tag": [
    "COMB"
  ],
  "difficulty": "",
  "question": "Alice and Bob play a game in which they take turns choosing integers from $1$ to $n$. Before any integers are chosen, Bob selects a goal of ``odd'' or ``even''. On the first turn, Alice chooses one of the $n$ integers. On the second turn, Bob chooses one of the remaining integers. They continue alternately choosing one of the integers that has not yet been chosen, until the $n$th turn, which is forced and ends the game. Bob wins if the parity of $\\{k\\colon \\mbox{the number $k$ was chosen on the $k$th turn}\\}$ matches his goal. For which values of $n$ does Bob have a winning strategy?",
  "solution": "(Communicated by Kai Wang)\nFor all $n$, Bob has a winning strategy. Note that we can interpret the game play as building a permutation of $\\{1,\\dots,n\\}$, and the number of times an integer $k$ is chosen on the $k$-th turn is exactly the number of fixed points of this permutation.\n\nFor $n$ even, Bob selects the goal ``even''. Divide $\\{1,\\dots,n\\}$ into the pairs $\\{1,2\\},\\{3,4\\},\\dots$; each time Alice chooses an integer, Bob follows suit with the other integer in the same pair. For each pair $\\{2k-1,2k\\}$, we see that $2k-1$ is a fixed point if and only if $2k$ is, so the number of fixed points is even.\n\nFor $n$ odd, Bob selects the goal ``odd''. On the first turn, if Alice chooses 1 or 2, then Bob chooses the other one to transpose into the strategy for $n-2$ (with no moves made). We may thus assume hereafter that Alice's first move is some $k > 2$, which Bob counters with 2; at this point there is exactly one fixed point. \n\nThereafter, as long as Alice chooses $j$ on the $j$-th turn (for $j \\geq 3$ odd), either $j+1 < k$, in which case Bob can choose $j+1$\nto keep the number of fixed points odd; or $j+1=k$, in which case $k$ is even and Bob can choose 1 to transpose into the strategy for  $n-k$ (with no moves made).\n\nOtherwise, at some odd turn $j$, Alice does not choose $j$. At this point, the number of fixed points is odd, and on each subsequent turn Bob can ensure that neither his own move nor Alice's next move does not create a fixed point: on any turn $j$ for Bob, if $j+1$ is available Bob chooses it; otherwise, Bob has at least two choices available, so he can choose a value other than $j$.",
  "vars": [
    "k",
    "j"
  ],
  "params": [
    "n"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "k": "turnindex",
        "j": "moveindex",
        "n": "totalcount"
      },
      "question": "Alice and Bob play a game in which they take turns choosing integers from $1$ to $totalcount$. Before any integers are chosen, Bob selects a goal of ``odd'' or ``even''. On the first turn, Alice chooses one of the $totalcount$ integers. On the second turn, Bob chooses one of the remaining integers. They continue alternately choosing one of the integers that has not yet been chosen, until the $totalcount$th turn, which is forced and ends the game. Bob wins if the parity of $\\{turnindex\\colon \\mbox{the number $turnindex$ was chosen on the $turnindex$th turn}\\}$ matches his goal. For which values of $totalcount$ does Bob have a winning strategy?",
      "solution": "(Communicated by Kai Wang)\nFor all $totalcount$, Bob has a winning strategy. Note that we can interpret the game play as building a permutation of $\\{1,\\dots,totalcount\\}$, and the number of times an integer $turnindex$ is chosen on the $turnindex$-th turn is exactly the number of fixed points of this permutation.\n\nFor $totalcount$ even, Bob selects the goal ``even''. Divide $\\{1,\\dots,totalcount\\}$ into the pairs $\\{1,2\\},\\{3,4\\},\\dots$; each time Alice chooses an integer, Bob follows suit with the other integer in the same pair. For each pair $\\{2\\,turnindex-1,2\\,turnindex\\}$, we see that $2\\,turnindex-1$ is a fixed point if and only if $2\\,turnindex$ is, so the number of fixed points is even.\n\nFor $totalcount$ odd, Bob selects the goal ``odd''. On the first turn, if Alice chooses 1 or 2, then Bob chooses the other one to transpose into the strategy for $totalcount-2$ (with no moves made). We may thus assume hereafter that Alice's first move is some $turnindex > 2$, which Bob counters with 2; at this point there is exactly one fixed point. \n\nThereafter, as long as Alice chooses $moveindex$ on the $moveindex$-th turn (for $moveindex \\geq 3$ odd), either $moveindex+1 < turnindex$, in which case Bob can choose $moveindex+1$ to keep the number of fixed points odd; or $moveindex+1=turnindex$, in which case $turnindex$ is even and Bob can choose 1 to transpose into the strategy for  $totalcount-turnindex$ (with no moves made).\n\nOtherwise, at some odd turn $moveindex$, Alice does not choose $moveindex$. At this point, the number of fixed points is odd, and on each subsequent turn Bob can ensure that neither his own move nor Alice's next move does not create a fixed point: on any turn $moveindex$ for Bob, if $moveindex+1$ is available Bob chooses it; otherwise, Bob has at least two choices available, so he can choose a value other than $moveindex$."
    },
    "descriptive_long_confusing": {
      "map": {
        "k": "sunflower",
        "j": "harmonica",
        "n": "lighthouse"
      },
      "question": "Alice and Bob play a game in which they take turns choosing integers from $1$ to $lighthouse$. Before any integers are chosen, Bob selects a goal of ``odd'' or ``even''. On the first turn, Alice chooses one of the $lighthouse$ integers. On the second turn, Bob chooses one of the remaining integers. They continue alternately choosing one of the integers that has not yet been chosen, until the $lighthouse$th turn, which is forced and ends the game. Bob wins if the parity of $\\{sunflower\\colon \\mbox{the number $sunflower$ was chosen on the $sunflower$th turn}\\}$ matches his goal. For which values of $lighthouse$ does Bob have a winning strategy?",
      "solution": "(Communicated by Kai Wang)\nFor all $lighthouse$, Bob has a winning strategy. Note that we can interpret the game play as building a permutation of $\\{1,\\dots,lighthouse\\}$, and the number of times an integer $sunflower$ is chosen on the $sunflower$-th turn is exactly the number of fixed points of this permutation.\n\nFor $lighthouse$ even, Bob selects the goal ``even''. Divide $\\{1,\\dots,lighthouse\\}$ into the pairs $\\{1,2\\},\\{3,4\\},\\dots$; each time Alice chooses an integer, Bob follows suit with the other integer in the same pair. For each pair $\\{2sunflower-1,2sunflower\\}$, we see that $2sunflower-1$ is a fixed point if and only if $2sunflower$ is, so the number of fixed points is even.\n\nFor $lighthouse$ odd, Bob selects the goal ``odd''. On the first turn, if Alice chooses 1 or 2, then Bob chooses the other one to transpose into the strategy for $lighthouse-2$ (with no moves made). We may thus assume hereafter that Alice's first move is some $sunflower > 2$, which Bob counters with 2; at this point there is exactly one fixed point. \n\nThereafter, as long as Alice chooses $harmonica$ on the $harmonica$-th turn (for $harmonica \\geq 3$ odd), either $harmonica+1 < sunflower$, in which case Bob can choose $harmonica+1$\n to keep the number of fixed points odd; or $harmonica+1=sunflower$, in which case $sunflower$ is even and Bob can choose 1 to transpose into the strategy for  $lighthouse-sunflower$ (with no moves made).\n\nOtherwise, at some odd turn $harmonica$, Alice does not choose $harmonica$. At this point, the number of fixed points is odd, and on each subsequent turn Bob can ensure that neither his own move nor Alice's next move does not create a fixed point: on any turn $harmonica$ for Bob, if $harmonica+1$ is available Bob chooses it; otherwise, Bob has at least two choices available, so he can choose a value other than $harmonica$. "
    },
    "descriptive_long_misleading": {
      "map": {
        "k": "steadyvalue",
        "j": "rigidindex",
        "n": "variabletotal"
      },
      "question": "Alice and Bob play a game in which they take turns choosing integers from $1$ to $variabletotal$. Before any integers are chosen, Bob selects a goal of ``odd'' or ``even''. On the first turn, Alice chooses one of the $variabletotal$ integers. On the second turn, Bob chooses one of the remaining integers. They continue alternately choosing one of the integers that has not yet been chosen, until the $variabletotal$th turn, which is forced and ends the game. Bob wins if the parity of $\\{steadyvalue\\colon \\mbox{the number $steadyvalue$ was chosen on the $steadyvalue$th turn}\\}$ matches his goal. For which values of $variabletotal$ does Bob have a winning strategy?",
      "solution": "(Communicated by Kai Wang)\nFor all $variabletotal$, Bob has a winning strategy. Note that we can interpret the game play as building a permutation of $\\{1,\\dots,variabletotal\\}$, and the number of times an integer $steadyvalue$ is chosen on the $steadyvalue$-th turn is exactly the number of fixed points of this permutation.\n\nFor $variabletotal$ even, Bob selects the goal ``even''. Divide $\\{1,\\dots,variabletotal\\}$ into the pairs $\\{1,2\\},\\{3,4\\},\\dots$; each time Alice chooses an integer, Bob follows suit with the other integer in the same pair. For each pair $\\{2steadyvalue-1,2steadyvalue\\}$, we see that $2steadyvalue-1$ is a fixed point if and only if $2steadyvalue$ is, so the number of fixed points is even.\n\nFor $variabletotal$ odd, Bob selects the goal ``odd''. On the first turn, if Alice chooses 1 or 2, then Bob chooses the other one to transpose into the strategy for $variabletotal-2$ (with no moves made). We may thus assume hereafter that Alice's first move is some $steadyvalue > 2$, which Bob counters with 2; at this point there is exactly one fixed point. \n\nThereafter, as long as Alice chooses $rigidindex$ on the $rigidindex$-th turn (for $rigidindex \\geq 3$ odd), either $rigidindex+1 < steadyvalue$, in which case Bob can choose $rigidindex+1$\n to keep the number of fixed points odd; or $rigidindex+1=steadyvalue$, in which case $steadyvalue$ is even and Bob can choose 1 to transpose into the strategy for  $variabletotal-steadyvalue$ (with no moves made).\n\nOtherwise, at some odd turn $rigidindex$, Alice does not choose $rigidindex$. At this point, the number of fixed points is odd, and on each subsequent turn Bob can ensure that neither his own move nor Alice's next move does not create a fixed point: on any turn $rigidindex$ for Bob, if $rigidindex+1$ is available Bob chooses it; otherwise, Bob has at least two choices available, so he can choose a value other than $rigidindex$.",
      "error": false
    },
    "garbled_string": {
      "map": {
        "k": "hjgrksla",
        "j": "pfqnemtu",
        "n": "qzxwvtnp"
      },
      "question": "Alice and Bob play a game in which they take turns choosing integers from $1$ to $qzxwvtnp$. Before any integers are chosen, Bob selects a goal of ``odd'' or ``even''. On the first turn, Alice chooses one of the $qzxwvtnp$ integers. On the second turn, Bob chooses one of the remaining integers. They continue alternately choosing one of the integers that has not yet been chosen, until the $qzxwvtnp$th turn, which is forced and ends the game. Bob wins if the parity of $\\{hjgrksla\\colon \\mbox{the number $hjgrksla$ was chosen on the $hjgrksla$th turn}\\}$ matches his goal. For which values of $qzxwvtnp$ does Bob have a winning strategy?",
      "solution": "(Communicated by Kai Wang)\nFor all $qzxwvtnp$, Bob has a winning strategy. Note that we can interpret the game play as building a permutation of $\\{1,\\dots,qzxwvtnp\\}$, and the number of times an integer $hjgrksla$ is chosen on the $hjgrksla$-th turn is exactly the number of fixed points of this permutation.\n\nFor $qzxwvtnp$ even, Bob selects the goal ``even''. Divide $\\{1,\\dots,qzxwvtnp\\}$ into the pairs $\\{1,2\\},\\{3,4\\},\\dots$; each time Alice chooses an integer, Bob follows suit with the other integer in the same pair. For each pair $\\{2hjgrksla-1,2hjgrksla\\}$, we see that $2hjgrksla-1$ is a fixed point if and only if $2hjgrksla$ is, so the number of fixed points is even.\n\nFor $qzxwvtnp$ odd, Bob selects the goal ``odd''. On the first turn, if Alice chooses 1 or 2, then Bob chooses the other one to transpose into the strategy for $qzxwvtnp-2$ (with no moves made). We may thus assume hereafter that Alice's first move is some $hjgrksla > 2$, which Bob counters with 2; at this point there is exactly one fixed point.\n\nThereafter, as long as Alice chooses $pfqnemtu$ on the $pfqnemtu$-th turn (for $pfqnemtu \\geq 3$ odd), either $pfqnemtu+1 < hjgrksla$, in which case Bob can choose $pfqnemtu+1$ to keep the number of fixed points odd; or $pfqnemtu+1=hjgrksla$, in which case $hjgrksla$ is even and Bob can choose 1 to transpose into the strategy for $qzxwvtnp-hjgrksla$ (with no moves made).\n\nOtherwise, at some odd turn $pfqnemtu$, Alice does not choose $pfqnemtu$. At this point, the number of fixed points is odd, and on each subsequent turn Bob can ensure that neither his own move nor Alice's next move does not create a fixed point: on any turn $pfqnemtu$ for Bob, if $pfqnemtu+1$ is available Bob chooses it; otherwise, Bob has at least two choices available, so he can choose a value other than $pfqnemtu$. "
    },
    "kernel_variant": {
      "question": "Let n ≥ 2 be a fixed integer. Alice and Bob alternately pick distinct numbers from the set {1,2,…,n}: Alice moves on the odd–numbered turns 1,3,5,…, while Bob moves on the even–numbered turns 2,4,6,… . After turn k we denote by a_k the number chosen, so the play produces a permutation (a_1 , a_2 , … , a_n) of {1,2,…,n}.\n\nBefore play starts Bob publicly announces one of the two words  “even’’ or “odd’’.  When the game ends we put\n        F = | { k : a_k = k } | ,\nnamely the number of fixed points of the permutation that has been produced.  Bob wins exactly when the parity of F (even or odd) equals the word he announced.\n\nFor which integers n ≥ 2 does Bob have a winning strategy?",
      "solution": "Answer.\nBob can always win.  He announces “even’’ when n is even and “odd’’ when n is odd.\n\nWe give explicit winning strategies.  Throughout we write P(n) for the parity that Bob announces:\n        P(n)=0 (\"even\") if n is even,    P(n)=1 (\"odd\") if n is odd.\n\n────────────────────────────────────────────\n1.  n even (n = 2m).\n────────────────────────────────────────────\n\nBob partitions {1,…,n} into the m disjoint pairs\n        {1,2}, {3,4}, … , {2m−1,2m}.       (∗)\n\nStrategy  E (pairing).\nWhenever Alice chooses one element x of a pair (∗), Bob immediately chooses the other element y of the same pair on his following move.\n\nAnalysis.\nEach pair contributes either 0 or 2 fixed points – 0 if the pair is removed in some position other than its own, 2 if it is removed in its natural positions.  Hence the total number F of fixed points is even and equals P(n), so Bob wins.\n\n────────────────────────────────────────────\n2.  n odd  (n = 2m+1 ≥ 3).\n────────────────────────────────────────────\n\nBob now announces “odd’’.  A completely different – inductive – strategy is required.\n\nWe begin with two easy base cases.\n\n   •  n = 3.  Whatever Alice does on turn 1, Bob chooses on turn 2 so that exactly one fixed point has been created; he can then prevent any further fixed points on the last move, so F = 1 (odd).\n   •  n = 1 is not allowed by the statement; n = 2 has already been settled in §1.\n\nAssume from now on n ≥ 5 (still odd) and that Bob already knows how to win for every smaller odd size.  Denote Alice’s first move by k.\n\nStage 0 – Bob’s reply on turn 2.\n\nCase 0A.  k ∈ {1,2}.  Bob chooses the other element of {1,2}.  Exactly 0 or 2 fixed points have been created, so the current parity is even.  Both numbers 1 and 2 have disappeared from play and the rest of the board, together with the turn numbers 3,…,n, is isomorphic to a fresh game of size n−2 (still odd).  Bob now follows his winning strategy for size n−2 and therefore wins the whole game.\n\nCase 0B.  k > 2.  Bob chooses the number 2.  One fixed point has been created (at position 2), so the current parity is odd.  Let us keep track of that first number k > 2; it will never be chosen by Bob.\n\nThe game continues from turn 3.  Bob’s further play is governed by the following two rules.\n\nStage 1 – as long as Alice keeps choosing the natural number of her turn.\n\nSuppose the game has reached an odd turn j ≥ 3 and that, on this turn, Alice indeed chooses the number j.\n\n   • If j+1 < k, then j+1 is still free.  Bob chooses j+1 on his even turn j+1.  Two new fixed points (j and j+1) have been created, so the parity of the running total has NOT changed – it is still odd.\n\n   • If j+1 = k, then k is even.  Bob now plays the number 1 instead (1 is still unused because k > 2).  No new fixed point is created on his move, so the running total is even.  At this moment every number ≤ k has been removed from play, and indices k+1,…,n form a board of odd size n−k < n; Bob restarts his inductive strategy there and wins.\n\nStage 2 – the first time Alice deviates.\n\nSooner or later Alice must reach an odd turn j on which she does NOT pick the number j (otherwise the game would end at turn n with the running total still odd and Bob would win).  From that moment on the parity of the fixed‐point count is odd.  Bob now simply makes sure that *no further fixed point is ever created*:\n\n   on every subsequent even turn ℓ he plays ℓ+1 if that number is still free; otherwise at least two numbers are available and Bob chooses one of them different from ℓ.  Consequently neither his own move nor the following move of Alice can be a fixed point.  The running total therefore stays odd until the end of the game, so Bob wins.\n\nCorrectness of the instructions.\n   •  In Stage 1 the number j+1 is always free in the first sub-case because no smaller even number can ever have been selected earlier by Bob (he uses every even number at most once, namely as soon as it is required).\n   •  The number 1 is free in the second sub-case because k > 2 and Bob never played 1 before.\n   •  In Stage 2 there are always at least two numbers left when Bob is to move (otherwise the game would have finished), so he can avoid creating a fixed point.\n\nThe strategy is legal and forces F to be odd.\n\n────────────────────────────────────────────\n3.  Conclusion.\n────────────────────────────────────────────\n\nFor even n Bob wins with Strategy E and parity = even.  For odd n he wins with the inductive strategy above and parity = odd.  Hence Bob possesses a winning strategy for every integer n ≥ 2.",
      "_meta": {
        "core_steps": [
          "View the sequence of chosen numbers as a permutation; Bob only needs to control the parity of its fixed-point count.",
          "Place the numbers in disjoint pairs; in each pair Bob always takes the partner of Alice’s choice, so fixed points are created two-at-a-time.",
          "When n is even this pairing alone keeps the fixed-point count even, giving Bob the desired parity.",
          "When n is odd Bob first forces exactly one fixed point with a pre-selected pair, then applies the same pairing strategy on the remaining even set, preserving the odd parity."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "The concrete way the numbers are paired for the mirroring strategy; only the existence of a perfect matching matters.",
            "original": "{1,2}, {3,4}, … , {n−1,n}"
          },
          "slot2": {
            "description": "Which particular pair is set aside to create the single fixed point in the odd-n case.",
            "original": "{1,2} (Bob answers 1 with 2 or vice-versa)"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "proof",
  "iteratively_fixed": true
}