{
  "index": "2005-A-2",
  "type": "COMB",
  "tag": [
    "COMB",
    "ALG"
  ],
  "difficulty": "",
  "question": "Let $\\mathbf{S} = \\{(a,b) | a = 1, 2, \\dots,n, b = 1,2,3\\}$.\nA \\emph{rook tour} of $\\mathbf{S}$ is a polygonal path made up of line\nsegments connecting points $p_1, p_2, \\dots, p_{3n}$ in sequence such that\n\\begin{enumerate}\n\\item[(i)] $p_i \\in \\mathbf{S}$,\n\\item[(ii)] $p_i$ and $p_{i+1}$ are a unit distance apart, for\n$1 \\leq i <3n$,\n\\item[(iii)] for each $p \\in \\mathbf{S}$ there is a unique $i$ such that\n$p_i = p$. How many rook tours are there that begin at $(1,1)$\nand end at $(n,1)$?\n\\end{enumerate}\n(An example of such a rook tour for $n=5$ was depicted in the original.)",
  "solution": "We will assume $n \\geq 2$ hereafter, since the answer is 0 for $n=1$.\n\n\\textbf{First solution:}\nWe show that the set of rook tours from $(1,1)$ to $(n,1)$ is in bijection with\nthe set of subsets of $\\{1,2,...,n\\}$ that include $n$ and contain an even number\nof elements in total.  Since the latter set evidently contains $2^{n-2}$ elements,\nso does the former.\n\nWe now construct the bijection.  Given a rook tour $P$ from $(1,1)$ to $(n,1)$,\nlet $S=S(P)$ denote the set of all $i \\in \\{1,2,\\ldots,n\\}$ for which there is\neither a directed edge from $(i,1)$ to $(i,2)$ or from $(i,3)$ to $(i,2)$.  It\nis clear that this set $S$ includes $n$ and must contain an even number of\nelements.  Conversely, given a subset $S=\\{a_1,a_2,\\ldots,a_{2r}=n\\}\n\\subset \\{1,2,\\ldots,n\\}$ of this type with $a_1<a_2<\\cdots<a_{2r}$,\nwe notice that there is a unique path $P$ containing\n$(a_i,2+(-1)^i),(a_1,2)$\nfor $i=1,2,\\ldots,2r$.  This establishes the desired bijection.\n\n\n\\textbf{Second solution:}\nLet $A_n$ denote the set of rook tours beginning at $(1,1)$ and\nending at $(n,1)$, and let $B_n$ denote the set of rook tours\nbeginning at $(1,1)$ and ending at $(n,3)$.\n\nFor $n \\geq 2$, we construct a bijection between $A_n$ and $A_{n-1}\n\\cup B_{n-1}$. Any path $P$ in $A_n$ contains either the line segment\n$P_1$ between $(n-1,1)$ and $(n,1)$, or the line segment $P_2$ between\n$(n,2)$ and $(n,1)$. In the former case, $P$ must also contain the\nsubpath $P_1'$ which joins $(n-1,3)$, $(n,3)$, $(n,2)$, and $(n-1,2)$\nconsecutively; then deleting $P_1$ and $P_1'$ from $P$ and adding the\nline segment joining $(n-1,3)$ to $(n-1,2)$ results in a path in\n$A_{n-1}$. (This construction is reversible, lengthening any path in\n$A_{n-1}$ to a path in $A_n$.) In the latter case, $P$ contains the\nsubpath $P_2'$ which joins $(n-1,3)$, $(n,3)$, $(n,2)$, $(n,1)$\nconsecutively; deleting $P_2'$ results in a path in $B_{n-1}$, and\nthis construction is also reversible. The desired bijection follows.\n\nSimilarly, there is a bijection between $B_n$ and $A_{n-1} \\cup\nB_{n-1}$ for $n \\geq 2$. It follows by induction that for $n \\geq 2$,\n$|A_n| = |B_n| = 2^{n-2} (|A_1| + |B_1|)$. But $|A_1| = 0$ and $|B_1|\n= 1$, and hence the desired answer is $|A_n| = 2^{n-2}$.\n\n\\textbf{Remarks:}\nOther bijective arguments are possible: for instance, Noam Elkies\npoints out that each element of $A_n \\cup B_n$\ncontains a different one of the possible sets of\nsegments of the form $(i,2),(i+1,2)$ for $i=1,\\dots,n-1$.\nRichard Stanley provides the reference: K.L. Collins and L.B. Krompart,\nThe number of Hamiltonian paths in a rectangular grid,\n\\textit{Discrete Math.}  \\textbf{169} (1997), 29--38. This problem\nis Theorem~1 of that paper; the cases of $4 \\times n$ and $5 \\times n$\ngrids\nare also treated. The paper can also be found online at the URL\n\\texttt{kcollins.web.wesleyan.edu/vita.htm}.",
  "vars": [
    "a",
    "b",
    "p",
    "p_i",
    "S",
    "A_n",
    "B_n",
    "P",
    "P_i",
    "a_i",
    "r",
    "P_1",
    "P_2"
  ],
  "params": [
    "n"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "a": "horizix",
        "b": "vertix",
        "p": "tourpt",
        "p_i": "tourpt_i",
        "S": "toursubset",
        "A_n": "tourseta_n",
        "B_n": "toursetb_n",
        "P": "rooktour",
        "P_i": "rookseg_i",
        "a_i": "subsetel_i",
        "r": "paircount",
        "P_1": "rooksegmentone",
        "P_2": "rooksegmenttwo",
        "n": "boardsize"
      },
      "question": "Let $\\mathbf{toursubset} = \\{(horizix,vertix) \\mid horizix = 1, 2, \\dots,boardsize, \\; vertix = 1,2,3\\}$.  \nA \\emph{rook tour} of $\\mathbf{toursubset}$ is a polygonal path made up of line\nsegments connecting points $tourpt_1, tourpt_2, \\dots, tourpt_{3boardsize}$ in sequence such that\n\\begin{enumerate}\n\\item[(i)] $tourpt_i \\in \\mathbf{toursubset}$,\n\\item[(ii)] $tourpt_i$ and $tourpt_{i+1}$ are a unit distance apart, for\n$1 \\le i < 3boardsize$,\n\\item[(iii)] for each $tourpt \\in \\mathbf{toursubset}$ there is a unique $i$ such that $tourpt_i = tourpt$.\nHow many rook tours are there that begin at $(1,1)$ and end at $(boardsize,1)$?\n\\end{enumerate}\n(An example of such a rook tour for $boardsize=5$ was depicted in the original.)",
      "solution": "We will assume $boardsize \\ge 2$ hereafter, since the answer is $0$ for $boardsize=1$.\n\n\\textbf{First solution:}\nWe show that the set of rook tours from $(1,1)$ to $(boardsize,1)$ is in bijection with the set of subsets of $\\{1,2,\\dots,boardsize\\}$ that include $boardsize$ and contain an even number of elements in total.  Since the latter set evidently contains $2^{boardsize-2}$ elements, so does the former.\n\nWe now construct the bijection.  Given a rook tour $rooktour$ from $(1,1)$ to $(boardsize,1)$, let $\\toursubset = \\toursubset(rooktour)$ denote the set of all $i \\in \\{1,2,\\ldots,boardsize\\}$ for which there is either a directed edge from $(i,1)$ to $(i,2)$ or from $(i,3)$ to $(i,2)$.  It is clear that this set $\\toursubset$ includes $boardsize$ and must contain an even number of elements.  Conversely, given a subset\n\\[\n\\toursubset = \\{subsetel_1, subsetel_2, \\ldots, subsetel_{2paircount}=boardsize\\} \\subset \\{1,2,\\ldots,boardsize\\}\n\\]\nof this type with $subsetel_1 < subsetel_2 < \\cdots < subsetel_{2paircount}$, we notice that there is a unique path $rooktour$ containing the points $(subsetel_i, 2+(-1)^i)$ and $(subsetel_1,2)$ for $i = 1,2,\\ldots,2paircount$.  This establishes the desired bijection.\n\n\\textbf{Second solution:}\nLet $tourseta_{boardsize}$ denote the set of rook tours beginning at $(1,1)$ and ending at $(boardsize,1)$, and let $toursetb_{boardsize}$ denote the set of rook tours beginning at $(1,1)$ and ending at $(boardsize,3)$.\n\nFor $boardsize \\ge 2$, we construct a bijection between $tourseta_{boardsize}$ and $tourseta_{boardsize-1} \\cup toursetb_{boardsize-1}$.  Any path $rooktour$ in $tourseta_{boardsize}$ contains either the line segment $rooksegmentone$ between $(boardsize-1,1)$ and $(boardsize,1)$, or the line segment $rooksegmenttwo$ between $(boardsize,2)$ and $(boardsize,1)$.  In the former case, $rooktour$ must also contain the subpath $rooksegmentone'$ which joins $(boardsize-1,3)$, $(boardsize,3)$, $(boardsize,2)$, and $(boardsize-1,2)$ consecutively; deleting $rooksegmentone$ and $rooksegmentone'$ from $rooktour$ and adding the line segment joining $(boardsize-1,3)$ to $(boardsize-1,2)$ results in a path in $tourseta_{boardsize-1}$.  (This construction is reversible, lengthening any path in $tourseta_{boardsize-1}$ to a path in $tourseta_{boardsize}$.)  In the latter case, $rooktour$ contains the subpath $rooksegmenttwo'$ which joins $(boardsize-1,3)$, $(boardsize,3)$, $(boardsize,2)$, $(boardsize,1)$ consecutively; deleting $rooksegmenttwo'$ results in a path in $toursetb_{boardsize-1}$, and this construction is also reversible.  The desired bijection follows.\n\nSimilarly, there is a bijection between $toursetb_{boardsize}$ and $tourseta_{boardsize-1} \\cup toursetb_{boardsize-1}$ for $boardsize \\ge 2$.  It follows by induction that for $boardsize \\ge 2$, $|tourseta_{boardsize}| = |toursetb_{boardsize}| = 2^{boardsize-2} (|tourseta_1| + |toursetb_1|)$.  But $|tourseta_1| = 0$ and $|toursetb_1| = 1$, and hence the desired answer is $|tourseta_{boardsize}| = 2^{boardsize-2}$.\n\n\\textbf{Remarks:} Other bijective arguments are possible: for instance, Noam Elkies points out that each element of $tourseta_{boardsize} \\cup toursetb_{boardsize}$ contains a different one of the possible sets of segments of the form $(i,2),(i+1,2)$ for $i = 1,\\dots,boardsize-1$.  Richard Stanley provides the reference: K.L. Collins and L.B. Krompart, \\emph{The number of Hamiltonian paths in a rectangular grid}, Discrete Math. \\textbf{169} (1997), 29--38.  This problem is Theorem~1 of that paper; the cases of $4 \\times boardsize$ and $5 \\times boardsize$ grids are also treated.  The paper can also be found online at the URL \\texttt{kcollins.web.wesleyan.edu/vita.htm}."
    },
    "descriptive_long_confusing": {
      "map": {
        "a": "lanterns",
        "b": "monolith",
        "p": "harpooner",
        "p_i": "harpooneri",
        "S": "astronaut",
        "A_n": "wilderness",
        "B_n": "lumberjack",
        "P": "quartzite",
        "P_i": "quartzitei",
        "a_i": "lanternsi",
        "r": "driftwood",
        "P_1": "hemlocken",
        "P_2": "graphitem",
        "n": "horizons"
      },
      "question": "Let $\\mathbf{astronaut} = \\{(lanterns,monolith) | lanterns = 1, 2, \\dots,horizons, monolith = 1,2,3\\}$.\\nA \\emph{rook tour} of $\\mathbf{astronaut}$ is a polygonal path made up of line\\nsegments connecting points $p_1, p_2, \\dots, p_{3horizons}$ in sequence such that\\n\\begin{enumerate}\\n\\item[(i)] harpooneri $\\in \\mathbf{astronaut}$,\\n\\item[(ii)] harpooneri and $p_{i+1}$ are a unit distance apart, for\\n$1 \\leq i <3horizons$,\\n\\item[(iii)] for each harpooner $\\in \\mathbf{astronaut}$ there is a unique $i$ such that\\nharpooneri = harpooner. How many rook tours are there that begin at $(1,1)$\\nand end at $(horizons,1)$?\\n\\end{enumerate}",
      "solution": "We will assume $horizons \\geq 2$ hereafter, since the answer is 0 for $horizons=1$.\\n\\n\\textbf{First solution:}\\nWe show that the set of rook tours from $(1,1)$ to $(horizons,1)$ is in bijection with\\nthe set of subsets of $\\{1,2,...,horizons\\}$ that include horizons and contain an even number\\nof elements in total.  Since the latter set evidently contains $2^{horizons-2}$ elements,\\nso does the former.\\n\\nWe now construct the bijection.  Given a rook tour quartzite from $(1,1)$ to $(horizons,1)$,\\nlet $astronaut=astronaut(quartzite)$ denote the set of all $i \\in \\{1,2,\\ldots,horizons\\}$ for which there is\\neither a directed edge from $(i,1)$ to $(i,2)$ or from $(i,3)$ to $(i,2)$.  It\\nis clear that this set astronaut includes horizons and must contain an even number of\\nelements.  Conversely, given a subset $astronaut=\\{lanterns_1,lanterns_2,\\ldots,lanterns_{2driftwood}=horizons\\}\\n\\subset \\{1,2,\\ldots,horizons\\}$ of this type with $lanterns_1<lanterns_2<\\cdots<lanterns_{2driftwood}$,\\nwe notice that there is a unique path quartzite containing\\n$(lanterns_i,2+(-1)^i),(lanterns_1,2)$\\nfor $i=1,2,\\ldots,2driftwood$.  This establishes the desired bijection.\\n\\n\\textbf{Second solution:}\\nLet wilderness denote the set of rook tours beginning at $(1,1)$ and\\nending at $(horizons,1)$, and let lumberjack denote the set of rook tours\\nbeginning at $(1,1)$ and ending at $(horizons,3)$.\\n\\nFor horizons $\\geq 2$, we construct a bijection between wilderness and $A_{horizons-1}\\n\\cup B_{horizons-1}$. Any path quartzite in wilderness contains either the line segment\\nhemlocken between $(horizons-1,1)$ and $(horizons,1)$, or the line segment graphitem between\\n$(horizons,2)$ and $(horizons,1)$. In the former case, quartzite must also contain the\\nsubpath $hemlocken'$ which joins $(horizons-1,3)$, $(horizons,3)$, $(horizons,2)$, and $(horizons-1,2)$\\nconsecutively; then deleting hemlocken and $hemlocken'$ from quartzite and adding the\\nline segment joining $(horizons-1,3)$ to $(horizons-1,2)$ results in a path in\\n$A_{horizons-1}$. (This construction is reversible, lengthening any path in\\n$A_{horizons-1}$ to a path in wilderness.) In the latter case, quartzite contains the\\nsubpath $graphitem'$ which joins $(horizons-1,3)$, $(horizons,3)$, $(horizons,2)$, $(horizons,1)$\\nconsecutively; deleting $graphitem'$ results in a path in $B_{horizons-1}$, and\\nthis construction is also reversible. The desired bijection follows.\\n\\nSimilarly, there is a bijection between lumberjack and $A_{horizons-1} \\cup\\nB_{horizons-1}$ for horizons $\\geq 2$. It follows by induction that for horizons $\\geq 2$,\\n$|wilderness| = |lumberjack| = 2^{horizons-2} (|A_1| + |B_1|)$. But $|A_1| = 0$ and $|B_1|\\n= 1$, and hence the desired answer is $|wilderness| = 2^{horizons-2}$.\\n\\n\\textbf{Remarks:}\\nOther bijective arguments are possible: for instance, Noam Elkies\\npoints out that each element of wilderness $\\cup$ lumberjack\\ncontains a different one of the possible sets of\\nsegments of the form $(i,2),(i+1,2)$ for $i=1,\\dots,horizons-1$.\\nRichard Stanley provides the reference: K.L. Collins and L.B. Krompart,\\nThe number of Hamiltonian paths in a rectangular grid,\\n\\textit{Discrete Math.}  \\textbf{169} (1997), 29--38. This problem\\nis Theorem~1 of that paper; the cases of $4 \\times horizons$ and $5 \\times horizons$\\ngrids\\nare also treated. The paper can also be found online at the URL\\n\\texttt{kcollins.web.wesleyan.edu/vita.htm}.}",
      "confidence": "0.12"
    },
    "descriptive_long_misleading": {
      "map": {
        "a": "lastletter",
        "b": "firstnumber",
        "p": "vastspace",
        "p_i": "planesection",
        "S": "emptiness",
        "A_n": "zeropaths",
        "B_n": "fullpaths",
        "P": "stillness",
        "P_i": "immobilephase",
        "a_i": "lateindex",
        "r": "stagnant",
        "P_1": "segmentone",
        "P_2": "segmenttwo",
        "n": "infinitum"
      },
      "question": "Let $\\mathbf{emptiness} = \\{(lastletter,firstnumber) | lastletter = 1, 2, \\dots,infinitum, firstnumber = 1,2,3\\}.$\nA \\emph{rook tour} of $\\mathbf{emptiness}$ is a polygonal path made up of line\nsegments connecting points $vastspace_1, vastspace_2, \\dots, vastspace_{3infinitum}$ in sequence such that\n\\begin{enumerate}\n\\item[(i)] planesection $\\in \\mathbf{emptiness}$,\n\\item[(ii)] planesection and $vastspace_{i+1}$ are a unit distance apart, for\n$1 \\leq i <3infinitum$,\n\\item[(iii)] for each vastspace $\\in \\mathbf{emptiness}$ there is a unique $i$ such that\nplanesection = vastspace.\nHow many rook tours are there that begin at $(1,1)$ and end at $(infinitum,1)$?\n\\end{enumerate}",
      "solution": "We will assume $infinitum \\geq 2$ hereafter, since the answer is 0 for $infinitum=1$.\n\n\\textbf{First solution:}\nWe show that the set of rook tours from $(1,1)$ to $(infinitum,1)$ is in bijection with\nthe set of subsets of $\\{1,2,...,infinitum\\}$ that include infinitum and contain an even number\nof elements in total.  Since the latter set evidently contains $2^{infinitum-2}$ elements,\nso does the former.\n\nWe now construct the bijection.  Given a rook tour stillness from $(1,1)$ to $(infinitum,1)$,\nlet emptiness=emptiness(stillness) denote the set of all $i \\in \\{1,2,\\ldots,infinitum\\}$ for which there is\neither a directed edge from $(i,1)$ to $(i,2)$ or from $(i,3)$ to $(i,2)$.  It\nis clear that this set emptiness includes infinitum and must contain an even number of\nelements.  Conversely, given a subset emptiness=$\\{lateindex_1,lateindex_2,\\ldots,lateindex_{2stagnant}=infinitum\\}\n\\subset \\{1,2,\\ldots,infinitum\\}$ of this type with $lateindex_1<lateindex_2<\\cdots<lateindex_{2stagnant}$,\nwe notice that there is a unique path stillness containing\n$(lateindex_i,2+(-1)^i),(lateindex_1,2)$\nfor $i=1,2,\\ldots,2stagnant$.  This establishes the desired bijection.\n\n\\textbf{Second solution:}\nLet zeropaths denote the set of rook tours beginning at $(1,1)$ and\nending at $(infinitum,1)$, and let fullpaths denote the set of rook tours\nbeginning at $(1,1)$ and ending at $(infinitum,3)$.\n\nFor $infinitum \\geq 2$, we construct a bijection between zeropaths and $A_{infinitum-1}\n\\cup B_{infinitum-1}$. Any path stillness in zeropaths contains either the line segment\nsegmentone between $(infinitum-1,1)$ and $(infinitum,1)$, or the line segment segmenttwo between\n$(infinitum,2)$ and $(infinitum,1)$. In the former case, stillness must also contain the\nsubpath $P_1'$ which joins $(infinitum-1,3)$, $(infinitum,3)$, $(infinitum,2)$, and $(infinitum-1,2)$\nconsecutively; then deleting segmentone and $P_1'$ from stillness and adding the\nline segment joining $(infinitum-1,3)$ to $(infinitum-1,2)$ results in a path in\n$A_{infinitum-1}$. (This construction is reversible, lengthening any path in\n$A_{infinitum-1}$ to a path in zeropaths.) In the latter case, stillness contains the\nsubpath $P_2'$ which joins $(infinitum-1,3)$, $(infinitum,3)$, $(infinitum,2)$, $(infinitum,1)$\nconsecutively; deleting $P_2'$ results in a path in $B_{infinitum-1}$, and\nthis construction is also reversible. The desired bijection follows.\n\nSimilarly, there is a bijection between fullpaths and $A_{infinitum-1} \\cup\nB_{infinitum-1}$ for $infinitum \\geq 2$. It follows by induction that for $infinitum \\geq 2$,\n$|zeropaths| = |fullpaths| = 2^{infinitum-2} (|A_1| + |B_1|)$. But $|A_1| = 0$ and $|B_1|\n= 1$, and hence the desired answer is $|zeropaths| = 2^{infinitum-2}$.\n\n\\textbf{Remarks:}\nOther bijective arguments are possible: for instance, Noam Elkies\npoints out that each element of zeropaths $\\cup$ fullpaths\ncontains a different one of the possible sets of\nsegments of the form $(i,2),(i+1,2)$ for $i=1,\\dots,infinitum-1$.\nRichard Stanley provides the reference: K.L. Collins and L.B. Krompart,\nThe number of Hamiltonian paths in a rectangular grid,\n\\textit{Discrete Math.}  \\textbf{169} (1997), 29--38. This problem\nis Theorem~1 of that paper; the cases of $4 \\times infinitum$ and $5 \\times infinitum$\ngrids\nare also treated. The paper can also be found online at the URL\n\\texttt{kcollins.web.wesleyan.edu/vita.htm}.",
      "solution_raw": ""
    },
    "garbled_string": {
      "map": {
        "a": "qzxwvtnp",
        "b": "hjgrksla",
        "p": "lkmqzvce",
        "p_i": "vtrsjbqa",
        "S": "ndzfpwro",
        "A_n": "yclvxgme",
        "B_n": "skoajwqu",
        "P": "ofiubnzr",
        "P_i": "xgebtspk",
        "a_i": "zrnqylcd",
        "r": "wpsdhjkv",
        "P_1": "mbvxyqre",
        "P_2": "csnlgkfa",
        "n": "ftgzlosy"
      },
      "question": "Let $\\mathbf{ndzfpwro} = \\{(qzxwvtnp,hjgrksla) | qzxwvtnp = 1, 2, \\dots,ftgzlosy, hjgrksla = 1,2,3\\}$. A \\emph{rook tour} of $\\mathbf{ndzfpwro}$ is a polygonal path made up of line segments connecting points $lkmqzvce_1, lkmqzvce_2, \\dots, lkmqzvce_{3ftgzlosy}$ in sequence such that \\begin{enumerate} \\item[(i)] $vtrsjbqa \\in \\mathbf{ndzfpwro}$, \\item[(ii)] $vtrsjbqa$ and $lkmqzvce_{i+1}$ are a unit distance apart, for $1 \\leq i <3ftgzlosy$, \\item[(iii)] for each $lkmqzvce \\in \\mathbf{ndzfpwro}$ there is a unique $i$ such that $vtrsjbqa = lkmqzvce$. How many rook tours are there that begin at $(1,1)$ and end at $(ftgzlosy,1)$? \\end{enumerate} (An example of such a rook tour for $ftgzlosy=5$ was depicted in the original.)",
      "solution": "We will assume $ftgzlosy \\geq 2$ hereafter, since the answer is 0 for $ftgzlosy=1$.\\par\\noindent\\textbf{First solution:} We show that the set of rook tours from $(1,1)$ to $(ftgzlosy,1)$ is in bijection with the set of subsets of $\\{1,2,...,ftgzlosy\\}$ that include $ftgzlosy$ and contain an even number of elements in total.  Since the latter set evidently contains $2^{ftgzlosy-2}$ elements, so does the former.\\par We now construct the bijection.  Given a rook tour ofiubnzr from $(1,1)$ to $(ftgzlosy,1)$, let ndzfpwro=ndzfpwro(ofiubnzr) denote the set of all $i \\in \\{1,2,\\ldots,ftgzlosy\\}$ for which there is either a directed edge from $(i,1)$ to $(i,2)$ or from $(i,3)$ to $(i,2)$.  It is clear that this set ndzfpwro includes $ftgzlosy$ and must contain an even number of elements.  Conversely, given a subset ndzfpwro=\\{zrnqylcd_1,zrnqylcd_2,\\ldots,zrnqylcd_{2wpsdhjkv}=ftgzlosy\\} \\subset \\{1,2,\\ldots,ftgzlosy\\}$ of this type with $zrnqylcd_1<zrnqylcd_2<\\cdots<zrnqylcd_{2wpsdhjkv}$, we notice that there is a unique path ofiubnzr containing $(zrnqylcd_i,2+(-1)^i),(zrnqylcd_1,2)$ for $i=1,2,\\ldots,2wpsdhjkv$.  This establishes the desired bijection.\\par\\noindent\\textbf{Second solution:} Let yclvxgme denote the set of rook tours beginning at $(1,1)$ and ending at $(ftgzlosy,1)$, and let skoajwqu denote the set of rook tours beginning at $(1,1)$ and ending at $(ftgzlosy,3)$.\\par For $ftgzlosy \\geq 2$, we construct a bijection between yclvxgme and yclvxgme_{ftgzlosy-1} \\cup skoajwqu_{ftgzlosy-1}. Any path ofiubnzr in yclvxgme contains either the line segment mbvxyqre between $(ftgzlosy-1,1)$ and $(ftgzlosy,1)$, or the line segment csnlgkfa between $(ftgzlosy,2)$ and $(ftgzlosy,1)$. In the former case, ofiubnzr must also contain the subpath mbvxyqre' which joins $(ftgzlosy-1,3)$, $(ftgzlosy,3)$, $(ftgzlosy,2)$, and $(ftgzlosy-1,2)$ consecutively; then deleting mbvxyqre and mbvxyqre' from ofiubnzr and adding the line segment joining $(ftgzlosy-1,3)$ to $(ftgzlosy-1,2)$ results in a path in yclvxgme_{ftgzlosy-1}. (This construction is reversible, lengthening any path in yclvxgme_{ftgzlosy-1} to a path in yclvxgme.) In the latter case, ofiubnzr contains the subpath csnlgkfa' which joins $(ftgzlosy-1,3)$, $(ftgzlosy,3)$, $(ftgzlosy,2)$, $(ftgzlosy,1)$ consecutively; deleting csnlgkfa' results in a path in skoajwqu_{ftgzlosy-1}, and this construction is also reversible. The desired bijection follows.\\par Similarly, there is a bijection between skoajwqu and yclvxgme_{ftgzlosy-1} \\cup skoajwqu_{ftgzlosy-1} for $ftgzlosy \\geq 2$. It follows by induction that for $ftgzlosy \\geq 2$, $|yclvxgme| = |skoajwqu| = 2^{ftgzlosy-2} (|A_1| + |B_1|)$. But $|A_1| = 0$ and $|B_1| = 1$, and hence the desired answer is $|yclvxgme| = 2^{ftgzlosy-2}$.\\par\\noindent\\textbf{Remarks:} Other bijective arguments are possible: for instance, Noam Elkies points out that each element of yclvxgme \\cup skoajwqu contains a different one of the possible sets of segments of the form $(i,2),(i+1,2)$ for $i=1,\\dots,ftgzlosy-1$. Richard Stanley provides the reference: K.L. Collins and L.B. Krompart, The number of Hamiltonian paths in a rectangular grid, \\textit{Discrete Math.}  \\textbf{169} (1997), 29--38. This problem is Theorem~1 of that paper; the cases of $4 \\times ftgzlosy$ and $5 \\times ftgzlosy$ grids are also treated. The paper can also be found online at the URL \\texttt{kcollins.web.wesleyan.edu/vita.htm}.",
      "status": "done"
    },
    "kernel_variant": {
      "question": "Let  n ≥ 2  be an integer and consider the 3 × n grid graph\n        G_n = { (c , r) | 0 ≤ c ≤ n−1  and  r ∈ {0,1,2} },\nwhose edges join any two vertices whose taxicab (Manhattan) distance is 1.\nThe rows are numbered 0 (bottom), 1 (middle), 2 (top).\n\nA Hamiltonian path of G_n that starts in the upper-left corner and ends in the upper-right corner,\n        v₁ = (0,2),      v_{3n} = (n−1,2),\nwill be called a rook-tour of G_n.\n\nDetermine, for every n ≥ 2, the number of rook-tours of G_n.",
      "solution": "Throughout we keep the numbering 0 (bottom), 1 (middle), 2 (top).\n\n1.  Notation\n   ----------\n   For n ≥ 2 write\n        A_n  = { rook-tours that start at (0,2) and finish at (n−1,2) },\n        B_n  = { Hamiltonian paths that start at (0,2) and finish at (n−1,0) }.\n   Put a_n = |A_n| and b_n = |B_n|.  We shall prove\n\n             a_n = b_n = 2^{n−2}            for every  n ≥ 2 .\n\n2.  The case n = 2\n   ----------------\n   All Hamiltonian paths on the 3 × 2 board can be listed easily.  One finds\n     A_2 = { (0,2)(0,1)(0,0)(1,0)(1,1)(1,2) },\n     B_2 = { (0,2)(1,2)(1,1)(0,1)(0,0)(1,0) }.\n   Hence a_2 = b_2 = 1, so the desired formula holds for n = 2.\n\n3.  Splitting the tours in A_n   (n ≥ 3)\n   -------------------------------------\n   The last edge used by every path in A_n must be incident with the terminal\n   vertex (n−1,2); hence it is either\n\n     Type H  (horizontal) : (n−2,2) – (n−1,2), or\n     Type V  (vertical)   : (n−1,1) – (n−1,2).\n\n   3·1  Paths of type H\n        ---------------\n        After the horizontal edge (n−2,2)–(n−1,2) is chosen, the other two\n        vertices of the last column, (n−1,1) and (n−1,0), still have to be\n        covered.  This can be done only through the 3-edge detour\n\n                (n−2,0) – (n−1,0) – (n−1,1) – (n−2,1).        (†)\n\n        Delete the final horizontal edge and the detour (†) and insert instead\n        the single edge (n−2,1)–(n−2,0).  What remains is a Hamiltonian path\n        on the first n−1 columns that still starts at (0,2) and now ends at\n        (n−2,2); i.e. an element of A_{n−1}.  The operation is reversible, so\n\n              { type-H paths in A_n }  ↔  A_{n−1}.            (1)\n\n   3·2  Paths of type V\n        ---------------\n        Suppose the last edge is the vertical edge (n−1,1)–(n−1,2).  Then the\n        two remaining vertices of the last column must be joined in the only\n        way still possible:\n\n                (n−1,1) – (n−1,0) – (n−2,0).                    (‡)\n\n        Deleting the fragment (‡) together with the final edge and deleting\n        the last column gives a path that now ends at (n−2,0), i.e. an element\n        of B_{n−1}.  Reversing the steps yields a bijection\n\n              { type-V paths in A_n }  ↔  B_{n−1}.             (2)\n\n   Combining (1) and (2) we get the first recursion\n\n                   a_n = a_{n−1} + b_{n−1}.                     (3)\n\n4.  An analogous splitting of B_n\n   ------------------------------\n   For B_n the terminal vertex is (n−1,0).  Its last edge is either\n\n        H′  (horizontal) : (n−2,0) – (n−1,0),\n        V′  (vertical)   : (n−1,1) – (n−1,0).\n\n   4·1  Type H′\n        -------\n        With the bottom horizontal edge fixed, the two vertices above the\n        endpoint can be visited only through the upper 3-edge detour\n\n                (n−2,2) – (n−1,2) – (n−1,1) – (n−2,1).        (††)\n\n        Deleting the final edge together with (††) and inserting the edge\n        (n−2,1)–(n−2,2) yields a path in A_{n−1}.  The construction is\n        reversible, hence\n\n              { type-H′ paths in B_n }  ↔  A_{n−1}.            (4)\n\n   4·2  Type V′\n        -------\n        Now the last edge is the vertical edge (n−1,1)–(n−1,0).  Because\n        (n−1,0) is an endpoint, the horizontal edge (n−2,0)–(n−1,0) is absent.\n        To give every vertex its required degree we are forced into the\n        vertical staircase\n\n                (n−2,2) – (n−1,2) – (n−1,1) – (n−1,0).        (‡‡)\n\n        Remove the three vertices (n−1,2), (n−1,1), (n−1,0) together with the\n        three staircase edges.  What remains is a Hamiltonian path on the\n        first n−1 columns which still starts at (0,2) and now ends at\n        (n−2,2); i.e. an element of A_{n−1}.  The operation is reversible (to\n        reconstruct the staircase, append the edges in the order (n−2,2)–\n        (n−1,2)–(n−1,1)–(n−1,0)), whence\n\n              { type-V′ paths in B_n }  ↔  A_{n−1}.            (5)\n\n   From (4) and (5) we obtain the second recursion\n\n                   b_n = 2 a_{n−1}.                            (6)\n\n5.  Solving the recursions\n   -----------------------\n   We already know a_2 = b_2 = 1.  Suppose for some n ≥ 3 we have shown\n   a_{n−1} = b_{n−1}.  Then (3) and (6) give\n\n        a_n = a_{n−1}+b_{n−1} = 2 a_{n−1},\n        b_n = 2 a_{n−1} = a_n.\n\n   Thus a_n = b_n for this n as well, and by induction\n\n        a_n = b_n  for every n ≥ 2.                             (7)\n\n   From (3) and (7) we obtain the simple first-order recursion\n\n        a_n = 2 a_{n−1}   (n ≥ 3).\n\n   With a_2 = 1 we finally have\n\n        a_n = 2^{n−2}   (n ≥ 2),\n\n   and the same formula for b_n by (7).\n\n6.  Answer\n   -------\n   The number of rook-tours of the 3 × n grid graph that start at (0,2) and end\n   at (n−1,2) equals\n\n                     2^{n−2}.\n\n   ∎",
      "_meta": {
        "core_steps": [
          "Associate to every rook tour the set S of column indices where the path enters the middle row by a vertical edge.",
          "Observe that S must (a) contain the last column and (b) have even cardinality (entry–exit parity in the middle row).",
          "Prove the map  Tour → S is bijective by giving an explicit reconstruction of the tour from any admissible S.",
          "Count admissible sets: choose any even-sized subset of {1,…,n} that contains n, giving 2^{n-2} possibilities."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "Exact coordinates of the prescribed start/end cells—as long as both are in the same extreme row, one at column 1 and the other at column n.",
            "original": "(1,1)  and  (n,1)"
          },
          "slot2": {
            "description": "Column that is forced to lie in S because it contains an endpoint.",
            "original": "n"
          },
          "slot3": {
            "description": "Required parity of |S| (changes if the two endpoints lie in different rows).",
            "original": "even"
          },
          "slot4": {
            "description": "Numerical labels chosen for the three rows; any consistent triple works.",
            "original": "1, 2, 3"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "calculation",
  "iteratively_fixed": true
}