{
  "index": "1965-A-5",
  "type": "COMB",
  "tag": [
    "COMB"
  ],
  "difficulty": "",
  "question": "A-5. In how many ways can the integers from 1 to \\( n \\) be ordered subject to the condition that, except for the first integer on the left, every integer differs by 1 from some integer to the left of it?",
  "solution": "A-5. On the basis of the first few cases we conjecture the answer is \\( 2^{n-1} \\) and proceed by induction.\n\nWe first show (also by induction) that an \\( n \\)-arrangement ends in 1 or \\( n \\). Note that when \\( n \\) is deleted from an \\( n \\)-arrangement, the result is an ( \\( n-1 \\) )arrangement. If an \\( n \\)-arrangement does not end in 1 or \\( n \\), deletion of \\( n \\) produces an ( \\( n-1 \\) )-arrangement ending (by induction) in ( \\( n-1 \\) ). This implies the \\( n \\) arrangement ended in \\( n \\) because \\( n \\) cannot precede ( \\( n-1 \\) ).\n\nFor any \\( n \\)-arrangement ( \\( a_{1}, a_{2}, \\cdots, a_{n} \\) ) there is another \\( n \\)-arrangement ( \\( a_{1}^{\\prime}, a_{2}^{\\prime}, \\cdots, a_{n}^{\\prime} \\) ), where \\( a_{i}^{\\prime}=n+1-a_{i} \\). If one of these ends in \\( n \\), the other ends in 1 and consequently exactly half of the \\( n \\)-arrangements end in \\( n \\).\n\nAll of the \\( n \\)-arrangements which end in \\( n \\) can be obtained by adjoining an \\( n \\) to the end of all \\( (n-1) \\)-arrangements, and by induction there are \\( 2^{n-2} \\) of these. Hence, there are \\( 2^{n-1} n \\)-arrangements.",
  "vars": [
    "a_1",
    "a_2",
    "a_n",
    "a_i"
  ],
  "params": [
    "n"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "a_1": "firstelem",
        "a_2": "secondelem",
        "a_n": "lastelem",
        "a_i": "genericel",
        "n": "setsize"
      },
      "question": "A-5. In how many ways can the integers from 1 to \\( setsize \\) be ordered subject to the condition that, except for the first integer on the left, every integer differs by 1 from some integer to the left of it?",
      "solution": "A-5. On the basis of the first few cases we conjecture the answer is \\( 2^{setsize-1} \\) and proceed by induction.\n\nWe first show (also by induction) that an \\( setsize \\)-arrangement ends in 1 or \\( setsize \\). Note that when \\( setsize \\) is deleted from an \\( setsize \\)-arrangement, the result is an ( \\( setsize-1 \\) )arrangement. If an \\( setsize \\)-arrangement does not end in 1 or \\( setsize \\), deletion of \\( setsize \\) produces an ( \\( setsize-1 \\) )-arrangement ending (by induction) in ( \\( setsize-1 \\) ). This implies the \\( setsize \\) arrangement ended in \\( setsize \\) because \\( setsize \\) cannot precede ( \\( setsize-1 \\) ).\n\nFor any \\( setsize \\)-arrangement ( \\( firstelem, secondelem, \\cdots, lastelem \\) ) there is another \\( setsize \\)-arrangement ( \\( firstelem^{\\prime}, secondelem^{\\prime}, \\cdots, lastelem^{\\prime} \\) ), where \\( genericel^{\\prime}=setsize+1-genericel \\). If one of these ends in \\( setsize \\), the other ends in 1 and consequently exactly half of the \\( setsize \\)-arrangements end in \\( setsize \\).\n\nAll of the \\( setsize \\)-arrangements which end in \\( setsize \\) can be obtained by adjoining an \\( setsize \\) to the end of all \\( (setsize-1) \\)-arrangements, and by induction there are \\( 2^{setsize-2} \\) of these. Hence, there are \\( 2^{setsize-1} \\) setsize-arrangements."
    },
    "descriptive_long_confusing": {
      "map": {
        "a_1": "butterfly",
        "a_2": "thunderclap",
        "a_n": "watermelon",
        "a_i": "honeycomb",
        "n": "copperpot"
      },
      "question": "A-5. In how many ways can the integers from 1 to \\( copperpot \\) be ordered subject to the condition that, except for the first integer on the left, every integer differs by 1 from some integer to the left of it?",
      "solution": "A-5. On the basis of the first few cases we conjecture the answer is \\( 2^{copperpot-1} \\) and proceed by induction.\n\nWe first show (also by induction) that an \\( copperpot \\)-arrangement ends in 1 or \\( copperpot \\). Note that when \\( copperpot \\) is deleted from an \\( copperpot \\)-arrangement, the result is an ( \\( copperpot-1 \\) )arrangement. If an \\( copperpot \\)-arrangement does not end in 1 or \\( copperpot \\), deletion of \\( copperpot \\) produces an ( \\( copperpot-1 \\) )-arrangement ending (by induction) in ( \\( copperpot-1 \\) ). This implies the \\( copperpot \\) arrangement ended in \\( copperpot \\) because \\( copperpot \\) cannot precede ( \\( copperpot-1 \\) ).\n\nFor any \\( copperpot \\)-arrangement ( \\( butterfly, thunderclap, \\cdots, watermelon \\) ) there is another \\( copperpot \\)-arrangement ( \\( butterfly^{\\prime}, thunderclap^{\\prime}, \\cdots, watermelon^{\\prime} \\) ), where \\( honeycomb^{\\prime}=copperpot+1-honeycomb \\). If one of these ends in \\( copperpot \\), the other ends in 1 and consequently exactly half of the \\( copperpot \\)-arrangements end in \\( copperpot \\).\n\nAll of the \\( copperpot \\)-arrangements which end in \\( copperpot \\) can be obtained by adjoining an \\( copperpot \\) to the end of all \\( (copperpot-1) \\)-arrangements, and by induction there are \\( 2^{copperpot-2} \\) of these. Hence, there are \\( 2^{copperpot-1} copperpot \\)-arrangements."
    },
    "descriptive_long_misleading": {
      "map": {
        "n": "minuscule",
        "a_1": "finalone",
        "a_2": "endingtwo",
        "a_n": "foremost",
        "a_i": "specificitem"
      },
      "question": "A-5. In how many ways can the integers from 1 to \\( minuscule \\) be ordered subject to the condition that, except for the first integer on the left, every integer differs by 1 from some integer to the left of it?",
      "solution": "A-5. On the basis of the first few cases we conjecture the answer is \\( 2^{minuscule-1} \\) and proceed by induction.\n\nWe first show (also by induction) that an \\( minuscule \\)-arrangement ends in 1 or \\( minuscule \\). Note that when \\( minuscule \\) is deleted from an \\( minuscule \\)-arrangement, the result is an ( \\( minuscule-1 \\) )arrangement. If an \\( minuscule \\)-arrangement does not end in 1 or \\( minuscule \\), deletion of \\( minuscule \\) produces an ( \\( minuscule-1 \\) )-arrangement ending (by induction) in ( \\( minuscule-1 \\) ). This implies the \\( minuscule \\) arrangement ended in \\( minuscule \\) because \\( minuscule \\) cannot precede ( \\( minuscule-1 \\) ).\n\nFor any \\( minuscule \\)-arrangement ( \\( finalone, endingtwo, \\cdots, foremost \\) ) there is another \\( minuscule \\)-arrangement ( \\( finalone^{\\prime}, endingtwo^{\\prime}, \\cdots, foremost^{\\prime} \\) ), where \\( specificitem^{\\prime}=minuscule+1-specificitem \\). If one of these ends in \\( minuscule \\), the other ends in 1 and consequently exactly half of the \\( minuscule \\)-arrangements end in \\( minuscule \\).\n\nAll of the \\( minuscule \\)-arrangements which end in \\( minuscule \\) can be obtained by adjoining an \\( minuscule \\) to the end of all \\( (minuscule-1) \\)-arrangements, and by induction there are \\( 2^{minuscule-2} \\) of these. Hence, there are \\( 2^{minuscule-1} minuscule \\)-arrangements."
    },
    "garbled_string": {
      "map": {
        "n": "qzxwvtnp",
        "a_1": "hjgrksla",
        "a_2": "pfjkewri",
        "a_n": "vnxqltza",
        "a_i": "yusdncqe"
      },
      "question": "A-5. In how many ways can the integers from 1 to \\( qzxwvtnp \\) be ordered subject to the condition that, except for the first integer on the left, every integer differs by 1 from some integer to the left of it?",
      "solution": "A-5. On the basis of the first few cases we conjecture the answer is \\( 2^{qzxwvtnp-1} \\) and proceed by induction.\n\nWe first show (also by induction) that an \\( qzxwvtnp \\)-arrangement ends in 1 or \\( qzxwvtnp \\). Note that when \\( qzxwvtnp \\) is deleted from an \\( qzxwvtnp \\)-arrangement, the result is an ( \\( qzxwvtnp-1 \\) )arrangement. If an \\( qzxwvtnp \\)-arrangement does not end in 1 or \\( qzxwvtnp \\), deletion of \\( qzxwvtnp \\) produces an ( \\( qzxwvtnp-1 \\) )-arrangement ending (by induction) in ( \\( qzxwvtnp-1 \\) ). This implies the \\( qzxwvtnp \\) arrangement ended in \\( qzxwvtnp \\) because \\( qzxwvtnp \\) cannot precede ( \\( qzxwvtnp-1 \\) ).\n\nFor any \\( qzxwvtnp \\)-arrangement ( \\( hjgrksla, pfjkewri, \\cdots, vnxqltza \\) ) there is another \\( qzxwvtnp \\)-arrangement ( \\( hjgrksla^{\\prime}, pfjkewri^{\\prime}, \\cdots, vnxqltza^{\\prime} \\) ), where \\( yusdncqe^{\\prime}=qzxwvtnp+1-yusdncqe \\). If one of these ends in \\( qzxwvtnp \\), the other ends in 1 and consequently exactly half of the \\( qzxwvtnp \\)-arrangements end in \\( qzxwvtnp \\).\n\nAll of the \\( qzxwvtnp \\)-arrangements which end in \\( qzxwvtnp \\) can be obtained by adjoining an \\( qzxwvtnp \\) to the end of all \\( (qzxwvtnp-1) \\)-arrangements, and by induction there are \\( 2^{qzxwvtnp-2} \\) of these. Hence, there are \\( 2^{qzxwvtnp-1} \\) \\( qzxwvtnp \\)-arrangements."
    },
    "kernel_variant": {
      "question": "Fix an odd positive integer n = 2m + 1 (m ≥ 0) and an arbitrary integer k.  \nPut  \n\n  S = { k, k + 1, …, k + n – 1 }  (size n).\n\nLabel the median element c = k + m.  \nA permutation  \n\n  (a₁, a₂, …, a_n) of S  \n\nis called strongly admissible if it simultaneously satisfies the following three conditions.\n\n1.  (Anchoring) a₁ = c.  \n2.  (Adjacency) For every j > 1 there is an earlier index i < j with |a_j – a_i| = 1.  \n3.  (Balance constraint) For every prefix (a₁,…,a_j) let  \n\n  L_j = #{ a_t < c : 1 ≤ t ≤ j }, R_j = #{ a_t > c : 1 ≤ t ≤ j }.  \n\n  Then L_j ≤ R_j for all j = 1,…,n.\n\nDetermine, in closed form, the number N(n) of strongly admissible permutations of S as a function of n (or, equivalently, of m = (n–1)/2).",
      "solution": "Step 1.  Reformulating the construction process  \nBecause of condition 2, after each step the set of elements already written must be a single interval of consecutive integers.  \nStarting with a₁ = c, the only way to enlarge this interval is to append either the left neighbour of the current interval or the right neighbour of the current interval.  Thus every strongly admissible permutation can be constructed by a sequence of “moves”\n\n  L  = “adjoin the current left neighbour”,  \n  R  = “adjoin the current right neighbour”,\n\nperformed exactly n – 1 = 2m times, beginning with the one-point interval {c}.  \nConsequently each permutation is encoded by a word  \n\n  w = w₁w₂…w_{2m}  with w_t ∈ {L,R}.\n\nStep 2.  Translation of the balance constraint  \nInitially L₀ = 0 and R₀ = 0.  \nWhenever we write an L we increase L by 1; an R increases R by 1.  \nHence after t moves\n\n  L_t = (# of L’s among w₁,…,w_t),  \n  R_t = (# of R’s among w₁,…,w_t).\n\nCondition 3 says L_t ≤ R_t for every t.  Equivalently, during the whole word the number of L’s never exceeds the number of R’s.  At the very end we must have written every element of S, so L_{2m} = R_{2m} = m.  \n\nThus w is a length-2m word in the alphabet {L,R} in which\n\n  (i) #L = #R = m, and  \n  (ii) in every initial segment, #L ≤ #R.\n\nStep 3.  Classical enumeration of such words  \nReplace the letter R by “(” and the letter L by “)”.  The two conditions above are exactly the defining conditions of a Dyck word (a balanced parenthesis word of semilength m).  \nThe number of Dyck words of semilength m is the m-th Catalan number  \n\n  C_m = (1/(m + 1))·(2m choose m).\n\nHence the number of length-2m words satisfying (i) and (ii) is C_m.\n\nStep 4.  Bijection between words and permutations  \nGiven a Dyck word w we reconstruct the permutation by actually carrying out the encoded sequence of L/R moves; conversely, reading “left” vs “right” extensions of any strongly admissible permutation produces its unique word w.  Therefore the Catalan count is exact:\n\n  N(n) = N(2m + 1) = C_m = 1/(m + 1) · (2m choose m).\n\nStep 5.  Final formula  \nIf n = 2m + 1 ≥ 1, the number of strongly admissible permutations of S is  \n\n  N(n) = Catalan_{(n–1)/2} = 1/((n + 1)/2) · (n – 1 choose (n – 1)/2).\n\n(When n = 1, m = 0 and C₀ = 1, which indeed gives the unique permutation (c).)",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T19:09:31.555931",
        "was_fixed": false,
        "difficulty_analysis": "•  Extra structural requirement: Beyond mere “there is an earlier neighbour ±1”, every prefix must respect the global balance L_j ≤ R_j.  This global, dynamical inequality introduces a dependency between all steps in the construction, eliminating the simple independent “left/right” choices that made the original problem easy.\n\n•  Sophisticated enumeration: The problem reduces to counting lattice paths that never fall below the axis, a classical Catalan-type situation.  Solving it demands recognising the bijection with Dyck words and employing the Catalan formula—substantially deeper than the induction yielding 2^{n–1} in the original.\n\n•  Higher conceptual load: One has to (i) translate permutations into growth processes, (ii) encode those by words, (iii) interpret the balance constraint as a monotonicity condition on partial counts, and (iv) recall (or derive) the Catalan enumeration via ballot numbers, reflection principle, or generating functions.\n\n•  Results in a non-trivial closed form (Catalan numbers) rather than a simple power of 2, demonstrating markedly greater technical and theoretical complexity while remaining completely solvable."
      }
    },
    "original_kernel_variant": {
      "question": "Fix an odd positive integer n = 2m + 1 (m ≥ 0) and an arbitrary integer k.  \nPut  \n\n  S = { k, k + 1, …, k + n – 1 }  (size n).\n\nLabel the median element c = k + m.  \nA permutation  \n\n  (a₁, a₂, …, a_n) of S  \n\nis called strongly admissible if it simultaneously satisfies the following three conditions.\n\n1.  (Anchoring) a₁ = c.  \n2.  (Adjacency) For every j > 1 there is an earlier index i < j with |a_j – a_i| = 1.  \n3.  (Balance constraint) For every prefix (a₁,…,a_j) let  \n\n  L_j = #{ a_t < c : 1 ≤ t ≤ j }, R_j = #{ a_t > c : 1 ≤ t ≤ j }.  \n\n  Then L_j ≤ R_j for all j = 1,…,n.\n\nDetermine, in closed form, the number N(n) of strongly admissible permutations of S as a function of n (or, equivalently, of m = (n–1)/2).",
      "solution": "Step 1.  Reformulating the construction process  \nBecause of condition 2, after each step the set of elements already written must be a single interval of consecutive integers.  \nStarting with a₁ = c, the only way to enlarge this interval is to append either the left neighbour of the current interval or the right neighbour of the current interval.  Thus every strongly admissible permutation can be constructed by a sequence of “moves”\n\n  L  = “adjoin the current left neighbour”,  \n  R  = “adjoin the current right neighbour”,\n\nperformed exactly n – 1 = 2m times, beginning with the one-point interval {c}.  \nConsequently each permutation is encoded by a word  \n\n  w = w₁w₂…w_{2m}  with w_t ∈ {L,R}.\n\nStep 2.  Translation of the balance constraint  \nInitially L₀ = 0 and R₀ = 0.  \nWhenever we write an L we increase L by 1; an R increases R by 1.  \nHence after t moves\n\n  L_t = (# of L’s among w₁,…,w_t),  \n  R_t = (# of R’s among w₁,…,w_t).\n\nCondition 3 says L_t ≤ R_t for every t.  Equivalently, during the whole word the number of L’s never exceeds the number of R’s.  At the very end we must have written every element of S, so L_{2m} = R_{2m} = m.  \n\nThus w is a length-2m word in the alphabet {L,R} in which\n\n  (i) #L = #R = m, and  \n  (ii) in every initial segment, #L ≤ #R.\n\nStep 3.  Classical enumeration of such words  \nReplace the letter R by “(” and the letter L by “)”.  The two conditions above are exactly the defining conditions of a Dyck word (a balanced parenthesis word of semilength m).  \nThe number of Dyck words of semilength m is the m-th Catalan number  \n\n  C_m = (1/(m + 1))·(2m choose m).\n\nHence the number of length-2m words satisfying (i) and (ii) is C_m.\n\nStep 4.  Bijection between words and permutations  \nGiven a Dyck word w we reconstruct the permutation by actually carrying out the encoded sequence of L/R moves; conversely, reading “left” vs “right” extensions of any strongly admissible permutation produces its unique word w.  Therefore the Catalan count is exact:\n\n  N(n) = N(2m + 1) = C_m = 1/(m + 1) · (2m choose m).\n\nStep 5.  Final formula  \nIf n = 2m + 1 ≥ 1, the number of strongly admissible permutations of S is  \n\n  N(n) = Catalan_{(n–1)/2} = 1/((n + 1)/2) · (n – 1 choose (n – 1)/2).\n\n(When n = 1, m = 0 and C₀ = 1, which indeed gives the unique permutation (c).)",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T01:37:45.458360",
        "was_fixed": false,
        "difficulty_analysis": "•  Extra structural requirement: Beyond mere “there is an earlier neighbour ±1”, every prefix must respect the global balance L_j ≤ R_j.  This global, dynamical inequality introduces a dependency between all steps in the construction, eliminating the simple independent “left/right” choices that made the original problem easy.\n\n•  Sophisticated enumeration: The problem reduces to counting lattice paths that never fall below the axis, a classical Catalan-type situation.  Solving it demands recognising the bijection with Dyck words and employing the Catalan formula—substantially deeper than the induction yielding 2^{n–1} in the original.\n\n•  Higher conceptual load: One has to (i) translate permutations into growth processes, (ii) encode those by words, (iii) interpret the balance constraint as a monotonicity condition on partial counts, and (iv) recall (or derive) the Catalan enumeration via ballot numbers, reflection principle, or generating functions.\n\n•  Results in a non-trivial closed form (Catalan numbers) rather than a simple power of 2, demonstrating markedly greater technical and theoretical complexity while remaining completely solvable."
      }
    }
  },
  "checked": true,
  "problem_type": "calculation",
  "iteratively_fixed": true
}