{
  "index": "2008-B-6",
  "type": "COMB",
  "tag": [
    "COMB",
    "NT",
    "ALG"
  ],
  "difficulty": "",
  "question": "Let $n$ and $k$ be positive integers. Say that a permutation $\\sigma$\nof $\\{1,2,\\dots,n\\}$ is \\emph{$k$-limited} if $|\\sigma(i) - i| \\leq k$\nfor all $i$. Prove that the number of $k$-limited permutations of\n$\\{1,2,\\dots,n\\}$ is odd if and only if $n \\equiv 0$ or $1$\n(mod $2k+1$).\n\n\\end{itemize}\n\n\\end{document}",
  "solution": "In all solutions,\nlet $F_{n,k}$ be the number of $k$-limited permutations of\n$\\{1,\\dots,n\\}$.\n\n\\textbf{First solution:}\n(by Jacob Tsimerman)\nNote that any permutation is $k$-limited if and only if its inverse is\n$k$-limited. Consequently, the number of $k$-limited permutations of\n$\\{1,\\dots,n\\}$ is the same as the number of $k$-limited involutions\n(permutations equal to their inverses) of $\\{1,\\dots,n\\}$.\n\nWe use the following fact several times: the number of involutions\nof $\\{1,\\dots,n\\}$ is odd if $n=0,1$ and even otherwise. This follows from\nthe fact that non-involutions come in pairs, so the number of involutions\nhas the same parity as the number of permutations, namely $n!$.\n\nFor $n \\leq k+1$, all involutions are $k$-limited.\nBy the previous paragraph, $F_{n,k}$ is odd for $n=0,1$ and even for\n$n=2,\\dots,k+1$.\n\nFor $n > k+1$, group the  $k$-limited involutions into classes based on\ntheir actions on $k+2,\\dots,n$. Note that for $C$ a class and $\\sigma \\in C$,\nthe set of elements of $A = \\{1,\\dots,k+1\\}$ which map into $A$ under\n$\\sigma$ depends only on $C$, not on $\\sigma$. Call this set $S(C)$; then\nthe size of $C$ is exactly the number of involutions of $S(C)$.\nConsequently, $|C|$ is even unless $S(C)$ has at most one element.\nHowever, the element 1 cannot map out of $A$ because we are looking at\n$k$-limited involutions. Hence if $S(C)$ has one element and $\\sigma \\in C$,\nwe must have $\\sigma(1) = 1$. Since $\\sigma$ is $k$-limited and\n$\\sigma(2)$ cannot belong to $A$, we must have $\\sigma(2) = k+2$. By\ninduction, for $i=3,\\dots,k+1$, we must have  $\\sigma(i) = k+i$.\n\nIf $n < 2k+1$, this shows that no class $C$ of odd cardinality can exist,\nso $F_{n,k}$ must be even. If $n \\geq 2k+1$, the classes of odd cardinality\nare in bijection with $k$-limited involutions of $\\{2k+2,\\dots,n\\}$,\nso $F_{n,k}$ has the same parity as $F_{n-2k-1,k}$. By induction on $n$,\nwe deduce the desired result.\n\n\\textbf{Second solution:}\n(by Yufei Zhao)\nLet $M_{n,k}$ be the $n \\times n$ matrix with\n\\[\n(M_{n,k})_{ij} = \\begin{cases} 1 & |i-j|\\leq k \\\\ 0 & \\mbox{otherwise.}\n\\end{cases}\n\\]\nWrite $\\det(M_{n,k})$ as the sum over permutations\n$\\sigma$ of $\\{1,\\dots,n\\}$ of\n$(M_{n,k})_{1 \\sigma(1)} \\cdots (M_{n,k})_{n \\sigma(n)}$\ntimes the signature of $\\sigma$. Then $\\sigma$ contributes $\\pm 1$\nto $\\det (M_{n,k})$ if $\\sigma$ is $k$-limited and 0 otherwise.\nWe conclude that\n\\[\n\\det(M_{n,k}) \\equiv F_{n,k} \\pmod{2}.\n\\]\nFor the rest of the solution, we interpret $M_{n,k}$ as a matrix\nover the field of two elements. We compute its determinant using\nlinear algebra modulo 2.\n\nWe first show that for $n \\geq 2k+1$,\n\\[\nF_{n,k} \\equiv F_{n-2k-1,k} \\pmod{2},\n\\]\nprovided that we interpret $F_{0,k} = 1$. We do this by\ncomputing $\\det(M_{n,k})$ using row and column operations.\nWe will verbally describe these operations for general $k$,\nwhile illustrating with the example $k=3$.\n\nTo begin with, $M_{n,k}$ has the following form.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 1 & 1 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nIn this presentation, the first $2k+1$ rows and columns are shown\nexplicitly; the remaining rows and columns are shown in a compressed format.\nThe symbol $\\emptyset$ indicates that the unseen entries are all zeroes,\nwhile the symbol $?$ indicates that they are not. The symbol $*$ in the\nlower right corner represents the matrix $F_{n-2k-1,k}$.\nWe will preserve the unseen structure of the matrix by only adding\nthe first $k+1$ rows or columns to any of the others.\n\nWe first add row 1 to each of rows $2, \\dots, k+1$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 1 & 1 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nWe next add column 1 to each of columns $2, \\dots, k+1$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nFor $i=2$, for each of $j=i+1,\\dots,2k+1$\nfor which the $(j, k+i)$-entry is nonzero,\nadd row $i$ to row $j$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 0 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 0 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 0 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & *\n\\end{array}\n\\right)\n\\]\nRepeat the previous step for $i=3,\\dots,k+1$ in succession.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 0 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 0 & 0 & 0 & ? \\\\\n0 & 0 & 1 & 1 & 0 & 0 & 0 & ? \\\\\n0 & 0 & 0 & 1 & 0 & 0 & 0 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & *\n\\end{array}\n\\right)\n\\]\nRepeat the two previous steps with the roles of the rows and columns reversed.\nThat is, for $i=2,\\dots,k+1$,\nfor each of $j=i+1,\\dots,2k+1$\nfor which the $(j, k+i)$-entry is nonzero,\nadd row $i$ to row $j$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 0 & 1 & \\emptyset \\\\\n0 & 1 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 1 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & *\n\\end{array}\n\\right)\n\\]\nWe now have a block diagonal matrix in which the top left\nblock is a $(2k+1) \\times (2k+1)$ matrix with nonzero determinant (it\nresults from reordering the rows of the identity matrix), the bottom right\nblock is $M_{n-2k-1,k}$, and the other two blocks are zero. We conclude that\n\\[\n\\det(M_{n,k}) \\equiv \\det(M_{n-2k-1,k})\n\\pmod{2},\n\\]\nproving the desired congruence.\n\nTo prove the desired result, we must now check that\n$F_{0,k}, F_{1,k}$ are odd and $F_{2,k}, \\dots, F_{2k,k}$ are even.\nFor $n=0,\\dots,k+1$, the matrix $M_{n,k}$ consists of all ones,\nso its determinant is 1 if $n=0,1$ and 0 otherwise.\n(Alternatively, we have $F_{n,k} = n!$ for $n=0,\\dots,k+1$,\nsince every permutation of $\\{1,\\dots,n\\}$ is $k$-limited.)\nFor $n=k+2,\\dots,2k$,\nobserve that rows $k$ and $k+1$ of $M_{n,k}$  both consist of all ones,\nso $\\det(M_{n,k}) = 0$ as desired.\n\n\\textbf{Third solution:} (by Tom Belulovich)\nDefine $M_{n,k}$ as in the second solution. We prove\n$\\det(M_{n,k})$ is odd for $n \\equiv 0,1 \\pmod{2k+1}$ and even otherwise,\nby directly determining whether or not $M_{n,k}$ is invertible as a matrix\nover the field of two elements.\n\nLet $r_i$ denote row $i$ of $M_{n,k}$.\nWe first check that if $n \\equiv 2, \\dots, 2k \\pmod{2k+1}$, then $M_{n,k}$\nis not invertible. In this case, we can find integers $0 \\leq a < b \\leq k$\nsuch that $n + a + b \\equiv 0 \\pmod{2k+1}$.\nPut $j = (n+a+b)/(2k+1)$. We can then write the\nall-ones vector both as\n\\[\n\\sum_{i=0}^{j-1} r_{k+1-a + (2k+1)i}\n\\]\nand as\n\\[\n\\sum_{i=0}^{j-1} r_{k+1-b + (2k+1)i}.\n\\]\nHence $M_{n,k}$ is not invertible.\n\nWe next check that if $n \\equiv 0,1 \\pmod{2k+1}$, then $M_{n,k}$\nis invertible. Suppose that $a_1,\\dots,a_n$ are scalars such that\n$a_1 r_1 + \\cdots + a_n r_n$ is the zero vector. The $m$-th coordinate\nof this vector equals $a_{m-k} + \\cdots + a_{m+k}$, where we regard\n$a_i$ as zero if $i \\notin \\{1,\\dots,n\\}$. By comparing consecutive\ncoordinates, we obtain\n\\[\na_{m-k} = a_{m+k+1} \\qquad (1 \\leq m < n).\n\\]\nIn particular, the $a_i$ repeat with period $2k+1$.\nTaking $m=1,\\dots,k$ further yields that\n\\[\na_{k+2} = \\cdots = a_{2k+1} = 0\n\\]\nwhile taking $m=n-k, \\dots,n-1$ yields\n\\[\na_{n-2k} =  \\dots = a_{n-1-k} = 0.\n\\]\nFor $n \\equiv 0 \\pmod{2k+1}$, the latter can be rewritten as\n\\[\na_1 = \\cdots = a_k = 0\n\\]\nwhereas for $n \\equiv 1 \\pmod{2k+1}$, it can be rewritten as\n\\[\na_2 = \\cdots = a_{k+1} = 0.\n\\]\nIn either case, since we also have\n\\[\na_1 + \\cdots + a_{2k+1} = 0\n\\]\nfrom the $(k+1)$-st coordinate, we deduce that all of the $a_i$ must be\nzero, and so $M_{n,k}$ must be invertible.\n\n\n\\textbf{Remark:}\nThe matrices $M_{n,k}$ are examples of \\emph{banded matrices},\nwhich occur frequently in numerical applications of linear algebra.\nThey are also examples of \\emph{Toeplitz matrices}.\n\n\\end{itemize}\n\\end{document}",
  "vars": [
    "i",
    "j",
    "m",
    "a_i",
    "r_i",
    "C",
    "A",
    "S",
    "\\\\sigma"
  ],
  "params": [
    "n",
    "k",
    "F_n,k",
    "M_n,k"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "i": "indexone",
        "j": "indextwo",
        "m": "indexthree",
        "a_i": "arraycoef",
        "r_i": "rowvector",
        "C": "classset",
        "A": "initialset",
        "S": "subsetset",
        "\\sigma": "permmap",
        "n": "arraysize",
        "k": "limitval",
        "F_n,k": "countklimited",
        "M_n,k": "bandmatrix"
      },
      "question": "Let $arraysize$ and $limitval$ be positive integers. Say that a permutation $permmap$ of $\\{1,2,\\dots,arraysize\\}$ is \\emph{$limitval$-limited} if $|permmap(indexone)-indexone|\\leq limitval$ for all $indexone$. Prove that the number of $limitval$-limited permutations of $\\{1,2,\\dots,arraysize\\}$ is odd if and only if $arraysize\\equiv0$ or $1$ (mod $2\\limitval+1$).",
      "solution": "In all solutions, let $countklimited$ be the number of $limitval$-limited permutations of $\\{1,\\dots,arraysize\\}$.  \n\n\\textbf{First solution.}  Note that any permutation is $limitval$-limited if and only if its inverse is $limitval$-limited. Consequently, the number of $limitval$-limited permutations of $\\{1,\\dots,arraysize\\}$ equals the number of $limitval$-limited involutions of $\\{1,\\dots,arraysize\\}$.  The number of involutions of $\\{1,\\dots,arraysize\\}$ is odd for $arraysize=0,1$ and even otherwise, because non-involutions come in pairs.  Hence, when $arraysize\\le limitval+1$ we have $countklimited$ odd for $arraysize=0,1$ and even for $arraysize=2,\\dots,limitval+1$.  \nFor $arraysize>limitval+1$ group the $limitval$-limited involutions into classes according to their action on $limitval+2,\\dots,arraysize$.  For each class $classset$ and any $permmap\\in classset$, the subset $subsetset(classset)\\subseteq initialset=\\{1,\\dots,limitval+1\\}$ that is mapped into $initialset$ depends only on $classset$.  The size of $classset$ equals the number of involutions of $subsetset(classset)$ and is therefore even unless $|\\subsetset(classset)|\\le1$.  Because 1 cannot leave $initialset$, the only possible odd classes force $permmap(1)=1$, $permmap(2)=limitval+2$, and inductively $permmap(indexone)=limitval+indexone$ for $indexone=3,\\dots,limitval+1$.  If $arraysize<2\\limitval+1$ no such class exists, so $countklimited$ is even.  If $arraysize\\ge2\\limitval+1$, the odd classes are in bijection with $limitval$-limited involutions of $\\{2\\limitval+2,\\dots,arraysize\\}$, giving $countklimited$ the same parity as $countklimited$ for $arraysize-2\\limitval-1$.  Induction on $arraysize$ yields the stated result.  \n\n\\textbf{Second solution.}  Let $bandmatrix$ be the $arraysize\\times arraysize$ matrix whose $(indexone,indextwo)$ entry is $1$ when $|indexone-indextwo|\\le limitval$ and $0$ otherwise.  Expanding $\\det(bandmatrix)$ shows that each $limitval$-limited permutation contributes $\\pm1$ and every other permutation contributes $0$, so $\\det(bandmatrix)\\equiv countklimited\\pmod2$.  Row- and column-operations (illustrated for $limitval=3$) convert $bandmatrix$ into a block-diagonal matrix with a $(2\\limitval+1)\\times(2\\limitval+1)$ identity-type block and a bottom-right block $bandmatrix$ of size $arraysize-2\\limitval-1$.  Hence $\\det(bandmatrix)\\equiv\\det$ of the smaller $bandmatrix$ modulo $2$, giving $countklimited\\equiv countklimited$ for size $arraysize-2\\limitval-1$.  Taking $countklimited=arraysize!$ for $arraysize\\le limitval+1$ (all permutations are then $limitval$-limited) shows that $countklimited$ is odd exactly when $arraysize\\equiv0,1\\pmod{2\\limitval+1}$.  \n\n\\textbf{Third solution.}  Again set $bandmatrix$ as above and write its $indexone$-th row as $rowvector_{indexone}$.  When $arraysize\\equiv2,\\dots,2\\limitval\\pmod{2\\limitval+1}$ there exist integers $0\\le a<b\\le limitval$ with $arraysize+a+b\\equiv0$.  Writing the all-ones vector both as $\\sum_{indexone=0}^{indextwo-1} rowvector_{limitval+1-a+(2\\limitval+1)indexone}$ and as $\\sum_{indexone=0}^{indextwo-1} rowvector_{limitval+1-b+(2\\limitval+1)indexone}$ shows that $bandmatrix$ is singular, so the determinant is even.  Conversely, if $arraysize\\equiv0,1\\pmod{2\\limitval+1}$ and $arraycoef_{1},\\dots,arraycoef_{arraysize}$ satisfy $\\sum arraycoef_{indexone}rowvector_{indexone}=0$, then comparing successive coordinates yields periodicity $arraycoef_{indexthree-\\limitval}=arraycoef_{indexthree+\\limitval+1}$, forcing all $arraycoef_{indexone}=0$ and hence invertibility; the determinant is therefore odd.  \n\n\\textbf{Remark.}  The matrices $bandmatrix$ are banded Toeplitz matrices, which are common in numerical linear algebra."
    },
    "descriptive_long_confusing": {
      "map": {
        "i": "honeymoon",
        "j": "toenailst",
        "m": "backtrack",
        "a_i": "grandpiano",
        "r_i": "chocolate",
        "C": "butterfly",
        "A": "playground",
        "S": "lighthouse",
        "\\\\sigma": "mountain",
        "n": "necklace",
        "k": "rainfall",
        "F_n,k": "caterpillar",
        "M_n,k": "tablespoon"
      },
      "question": "Let $necklace$ and $rainfall$ be positive integers. Say that a permutation $mountain$\nof $\\{1,2,\\dots,necklace\\}$ is \\emph{$rainfall$-limited} if $|mountain(honeymoon) - honeymoon| \\leq rainfall$\nfor all $honeymoon$. Prove that the number of $rainfall$-limited permutations of\n$\\{1,2,\\dots,necklace\\}$ is odd if and only if $necklace \\equiv 0$ or $1$\n(mod $2rainfall+1$).",
      "solution": "In all solutions,\nlet $caterpillar$ be the number of $rainfall$-limited permutations of\n$\\{1,\\dots,necklace\\}$. \n\n\\textbf{First solution:}\n(by Jacob Tsimerman)\nNote that any permutation is $rainfall$-limited if and only if its inverse is\n$rainfall$-limited. Consequently, the number of $rainfall$-limited permutations of\n$\\{1,\\dots,necklace\\}$ is the same as the number of $rainfall$-limited involutions\n(permutations equal to their inverses) of $\\{1,\\dots,necklace\\}$. \n\nWe use the following fact several times: the number of involutions\nof $\\{1,\\dots,necklace\\}$ is odd if $necklace=0,1$ and even otherwise. This follows from\nthe fact that non-involutions come in pairs, so the number of involutions\nhas the same parity as the number of permutations, namely $necklace!$. \n\nFor $necklace \\leq rainfall+1$, all involutions are $rainfall$-limited.\nBy the previous paragraph, $caterpillar$ is odd for $necklace=0,1$ and even for\n$necklace=2,\\dots,rainfall+1$. \n\nFor $necklace > rainfall+1$, group the  $rainfall$-limited involutions into classes based on\ntheir actions on $rainfall+2,\\dots,necklace$. Note that for $butterfly$ a class and $mountain \\in butterfly$,\nthe set of elements of $playground = \\{1,\\dots,rainfall+1\\}$ which map into $playground$ under\n$mountain$ depends only on $butterfly$, not on $mountain$. Call this set $lighthouse(butterfly)$; then\nthe size of $butterfly$ is exactly the number of involutions of $lighthouse(butterfly)$.\nConsequently, $|butterfly|$ is even unless $lighthouse(butterfly)$ has at most one element.\nHowever, the element 1 cannot map out of $playground$ because we are looking at\n$rainfall$-limited involutions. Hence if $lighthouse(butterfly)$ has one element and $mountain \\in butterfly$,\nwe must have $mountain(1) = 1$. Since $mountain$ is $rainfall$-limited and\n$mountain(2)$ cannot belong to $playground$, we must have $mountain(2) = rainfall+2$. By\ninduction, for $honeymoon=3,\\dots,rainfall+1$, we must have  $mountain(honeymoon) = rainfall+honeymoon$. \n\nIf $necklace < 2rainfall+1$, this shows that no class $butterfly$ of odd cardinality can exist,\nso $caterpillar$ must be even. If $necklace \\geq 2rainfall+1$, the classes of odd cardinality\nare in bijection with $rainfall$-limited involutions of $\\{2rainfall+2,\\dots,necklace\\}$,\nso $caterpillar$ has the same parity as $caterpillar_{necklace-2rainfall-1,rainfall}$. By induction on $necklace$,\nwe deduce the desired result.\n\n\\textbf{Second solution:}\n(by Yufei Zhao)\nLet $tablespoon$ be the $necklace \\times necklace$ matrix with\n\\[\n(tablespoon)_{ij} = \\begin{cases} 1 & |honeymoon-toenailst|\\leq rainfall \\\\ 0 & \\mbox{otherwise.}\n\\end{cases}\n\\]\nWrite $\\det(tablespoon)$ as the sum over permutations\n$mountain$ of $\\{1,\\dots,necklace\\}$ of\n$(tablespoon)_{1 \\, mountain(1)} \\cdots (tablespoon)_{necklace \\, mountain(necklace)}$\ntimes the signature of $mountain$. Then $mountain$ contributes $\\pm 1$\nto $\\det (tablespoon)$ if $mountain$ is $rainfall$-limited and 0 otherwise.\nWe conclude that\n\\[\n\\det(tablespoon) \\equiv caterpillar \\pmod{2}.\n\\]\nFor the rest of the solution, we interpret $tablespoon$ as a matrix\nover the field of two elements. We compute its determinant using\nlinear algebra modulo 2.\n\nWe first show that for $necklace \\geq 2rainfall+1$,\n\\[\ncaterpillar \\equiv caterpillar_{necklace-2rainfall-1,rainfall} \\pmod{2},\n\\]\nprovided that we interpret $caterpillar_{0,rainfall} = 1$. We do this by\ncomputing $\\det(tablespoon)$ using row and column operations.\nWe will verbally describe these operations for general $rainfall$,\nwhile illustrating with the example $rainfall=3$.\n\nTo begin with, $tablespoon$ has the following form.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 1 & 1 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\n(As before, $\\emptyset$ denotes unseen zero entries, and $*$ denotes $tablespoon_{necklace-2rainfall-1,rainfall}$.)\n\nWe first add row 1 to each of rows $2, \\dots, rainfall+1$, then perform the analogous column operations; next we systematically clear the remaining nonzero entries as described in the published solution.  Ultimately we arrive at a block–diagonal matrix whose upper-left block is a $(2rainfall+1)\\times(2rainfall+1)$ permutation of the identity, whose lower-right block is $tablespoon_{necklace-2rainfall-1,rainfall}$, and whose other two blocks are zero.  Hence\n\\[\n\\det(tablespoon) \\equiv \\det(tablespoon_{necklace-2rainfall-1,rainfall}) \\pmod{2},\n\\]\nproving the claimed congruence.\n\nTo complete the argument we verify that $caterpillar_{0,rainfall}$ and $caterpillar_{1,rainfall}$ are odd, whereas $caterpillar_{2,rainfall}, \\dots, c aterpillar_{2rainfall,rainfall}$ are even.  For $necklace=0,\\dots,rainfall+1$, the matrix $tablespoon$ consists entirely of ones, giving determinant $1$ for $necklace=0,1$ and $0$ otherwise.  (Equivalently, every permutation of $\\{1,\\dots,necklace\\}$ is $rainfall$-limited, so $caterpillar = necklace!$.)  For $necklace=rainfall+2,\\dots,2rainfall$, rows $rainfall$ and $rainfall+1$ of $tablespoon$ coincide, so the determinant is $0$.\n\n\\textbf{Third solution:} (by Tom Belulovich)\nDefine $tablespoon$ as in the second solution. We prove\n$\\det(tablespoon)$ is odd for $necklace \\equiv 0,1 \\pmod{2rainfall+1}$ and even otherwise,\nby directly determining whether or not $tablespoon$ is invertible over the field with two elements.\n\nLet chocolate denote row honeymoon of $tablespoon$.\nWe first check that if $necklace \\equiv 2, \\dots, 2rainfall \\pmod{2rainfall+1}$, then $tablespoon$\nis not invertible. In this case, we can find integers $0 \\leq grandpiano < backtrack \\leq rainfall$\nsuch that $necklace + grandpiano + backtrack \\equiv 0 \\pmod{2rainfall+1}$.\nPut $toenailst = (necklace+grandpiano+backtrack)/(2rainfall+1)$. We can then write the\nall-ones vector both as\n\\[\n\\sum_{honeymoon=0}^{toenailst-1} chocolate_{rainfall+1-grandpiano + (2rainfall+1)honeymoon}\n\\]\nand as\n\\[\n\\sum_{honeymoon=0}^{toenailst-1} chocolate_{rainfall+1-backtrack + (2rainfall+1)honeymoon}.\n\\]\nHence $tablespoon$ is not invertible.\n\nWe next check that if $necklace \\equiv 0,1 \\pmod{2rainfall+1}$, then $tablespoon$\nis invertible. Suppose that $grandpiano_1,\\dots,grandpiano_{necklace}$ are scalars such that\n$grandpiano_1 chocolate_1 + \\cdots + grandpiano_{necklace} chocolate_{necklace}$ is the zero vector. The $backtrack$-th coordinate\nof this vector equals $grandpiano_{backtrack-rainfall} + \\cdots + grandpiano_{backtrack+rainfall}$, where we regard\n$grandpiano_{honeymoon}$ as zero if $honeymoon \\notin \\{1,\\dots,necklace\\}$. By comparing consecutive\ncoordinates we obtain\n\\[\ngrandpiano_{backtrack-rainfall} = grandpiano_{backtrack+rainfall+1} \\qquad (1 \\leq backtrack < necklace).\n\\]\nThus the $grandpiano_{honeymoon}$ repeat with period $2rainfall+1$.\nTaking $backtrack=1,\\dots,rainfall$ gives\n\\[\ngrandpiano_{rainfall+2} = \\cdots = grandpiano_{2rainfall+1} = 0,\n\\]\nwhile taking $backtrack=necklace-rainfall, \\dots,necklace-1$ gives\n\\[\ngrandpiano_{necklace-2rainfall} = \\dots = grandpiano_{necklace-1-rainfall} = 0.\n\\]\nFor $necklace \\equiv 0 \\pmod{2rainfall+1}$, this rewrites as\n\\[\ngrandpiano_1 = \\cdots = grandpiano_{rainfall} = 0,\n\\]\nwhereas for $necklace \\equiv 1 \\pmod{2rainfall+1}$, it rewrites as\n\\[\ngrandpiano_2 = \\cdots = grandpiano_{rainfall+1} = 0.\n\\]\nIn either case, together with\n\\[\ngrandpiano_1 + \\cdots + grandpiano_{2rainfall+1} = 0,\n\\]\nwe deduce that all the $grandpiano_{honeymoon}$ vanish, so $tablespoon$ is invertible.\n\n\\textbf{Remark:}\nThe matrices $tablespoon$ are examples of \\emph{banded matrices}, which occur frequently in numerical linear algebra. They are also examples of \\emph{Toeplitz matrices}. \n"
    },
    "descriptive_long_misleading": {
      "map": {
        "i": "outermost",
        "j": "innermost",
        "m": "minimums",
        "a_i": "steadfast",
        "r_i": "columnar",
        "C": "individual",
        "A": "complement",
        "S": "superset",
        "\\\\sigma": "stagnation",
        "n": "emptiness",
        "k": "unbounded",
        "F_n,k": "rarityfunc",
        "M_n,k": "emptymatrix"
      },
      "question": "Let $emptiness$ and $unbounded$ be positive integers. Say that a permutation $stagnation$\nof $\\{1,2,\\dots,emptiness\\}$ is \\emph{$unbounded$-limited} if $|stagnation(outermost) - outermost| \\leq unbounded$\nfor all $outermost$. Prove that the number of $unbounded$-limited permutations of\n$\\{1,2,\\dots,emptiness\\}$ is odd if and only if $emptiness \\equiv 0$ or $1$\n(mod $2unbounded+1$).\n",
      "solution": "In all solutions,\nlet $rarityfunc$ be the number of $unbounded$-limited permutations of\n$\\{1,\\dots,emptiness\\}$. \n\n\\textbf{First solution:}\n(by Jacob Tsimerman)\nNote that any permutation is $unbounded$-limited if and only if its inverse is\n$unbounded$-limited. Consequently, the number of $unbounded$-limited permutations of\n$\\{1,\\dots,emptiness\\}$ is the same as the number of $unbounded$-limited involutions\n(permutations equal to their inverses) of $\\{1,\\dots,emptiness\\}$. \n\nWe use the following fact several times: the number of involutions\nof $\\{1,\\dots,emptiness\\}$ is odd if $emptiness=0,1$ and even otherwise. This follows from\nthe fact that non-involutions come in pairs, so the number of involutions\nhas the same parity as the number of permutations, namely $emptiness!$. \n\nFor $emptiness \\leq unbounded+1$, all involutions are $unbounded$-limited.\nBy the previous paragraph, $rarityfunc$ is odd for $emptiness=0,1$ and even for\n$emptiness=2,\\dots,unbounded+1$. \n\nFor $emptiness > unbounded+1$, group the  $unbounded$-limited involutions into classes based on\ntheir actions on $unbounded+2,\\dots,emptiness$. Note that for $individual$ a class and $stagnation \\in individual$,\nthe set of elements of $complement = \\{1,\\dots,unbounded+1\\}$ which map into $complement$ under\n$stagnation$ depends only on $individual$, not on $stagnation$. Call this set $superset(individual)$; then\nthe size of $individual$ is exactly the number of involutions of $superset(individual)$. \nConsequently, $|individual|$ is even unless $superset(individual)$ has at most one element.\nHowever, the element 1 cannot map out of $complement$ because we are looking at\n$unbounded$-limited involutions. Hence if $superset(individual)$ has one element and $stagnation \\in individual$,\nwe must have $stagnation(1) = 1$. Since $stagnation$ is $unbounded$-limited and\n$stagnation(2)$ cannot belong to $complement$, we must have $stagnation(2) = unbounded+2$. By\ninduction, for $outermost=3,\\dots,unbounded+1$, we must have  $stagnation(outermost) = unbounded+outermost$. \n\nIf $emptiness < 2unbounded+1$, this shows that no class $individual$ of odd cardinality can exist,\nso $rarityfunc$ must be even. If $emptiness \\geq 2unbounded+1$, the classes of odd cardinality\nare in bijection with $unbounded$-limited involutions of $\\{2unbounded+2,\\dots,emptiness\\}$,\nso $rarityfunc$ has the same parity as $F_{emptiness-2unbounded-1,unbounded}$. By induction on $emptiness$,\nwe deduce the desired result.\n\n\\textbf{Second solution:}\n(by Yufei Zhao)\nLet $emptymatrix$ be the $emptiness \\times emptiness$ matrix with\n\\[\n(emptymatrix)_{outermost\\, innermost} = \\begin{cases} 1 & |outermost-innermost|\\leq unbounded \\\\ 0 & \\mbox{otherwise.}\n\\end{cases}\n\\]\nWrite $\\det(emptymatrix)$ as the sum over permutations\n$stagnation$ of $\\{1,\\dots,emptiness\\}$ of\n$(emptymatrix)_{1\\, stagnation(1)} \\cdots (emptymatrix)_{emptiness\\, stagnation(emptiness)}$\ntimes the signature of $stagnation$. Then $stagnation$ contributes $\\pm 1$\nto $\\det (emptymatrix)$ if $stagnation$ is $unbounded$-limited and 0 otherwise.\nWe conclude that\n\\[\n\\det(emptymatrix) \\equiv rarityfunc \\pmod{2}.\n\\]\nFor the rest of the solution, we interpret $emptymatrix$ as a matrix\nover the field of two elements. We compute its determinant using\nlinear algebra modulo 2.\n\nWe first show that for $emptiness \\geq 2unbounded+1$,\n\\[\nrarityfunc \\equiv F_{emptiness-2unbounded-1,unbounded} \\pmod{2},\n\\]\nprovided that we interpret $F_{0,unbounded} = 1$. We do this by\ncomputing $\\det(emptymatrix)$ using row and column operations.\nWe will verbally describe these operations for general $unbounded$,\nwhile illustrating with the example $unbounded=3$.\n\nTo begin with, $emptymatrix$ has the following form.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 1 & 1 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nIn this presentation, the first $2unbounded+1$ rows and columns are shown\nexplicitly; the remaining rows and columns are shown in a compressed format.\nThe symbol $\\emptyset$ indicates that the unseen entries are all zeroes,\nwhile the symbol $?$ indicates that they are not. The symbol $*$ in the\nlower right corner represents the matrix $F_{emptiness-2unbounded-1,unbounded}$.\nWe will preserve the unseen structure of the matrix by only adding\nthe first $unbounded+1$ rows or columns to any of the others.\n\nWe first add row 1 to each of rows $2, \\dots, unbounded+1$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 1 & 1 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nWe next add column 1 to each of columns $2, \\dots, unbounded+1$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nFor $outermost=2$, for each of $innermost=outermost+1,\\dots,2unbounded+1$\nfor which the $(innermost, unbounded+outermost)$-entry is nonzero,\nadd row $outermost$ to row $innermost$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 0 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 0 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 0 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & *\n\\end{array}\n\\right)\n\\]\nRepeat the previous step for $outermost=3,\\dots,unbounded+1$ in succession.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 0 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 0 & 0 & 0 & ? \\\\\n0 & 0 & 1 & 1 & 0 & 0 & 0 & ? \\\\\n0 & 0 & 0 & 1 & 0 & 0 & 0 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & *\n\\end{array}\n\\right)\n\\]\nRepeat the two previous steps with the roles of the rows and columns reversed.\nThat is, for $outermost=2,\\dots,unbounded+1$,\nfor each of $innermost=outermost+1,\\dots,2unbounded+1$\nfor which the $(innermost, unbounded+outermost)$-entry is nonzero,\nadd row $outermost$ to row $innermost$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 0 & 1 & \\emptyset \\\\\n0 & 1 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 1 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & *\n\\end{array}\n\\right)\n\\]\nWe now have a block diagonal matrix in which the top left\nblock is a $(2unbounded+1) \\times (2unbounded+1)$ matrix with nonzero determinant (it\nresults from reordering the rows of the identity matrix), the bottom right\nblock is $M_{emptiness-2unbounded-1,unbounded}$, and the other two blocks are zero. We conclude that\n\\[\n\\det(emptymatrix) \\equiv \\det(M_{emptiness-2unbounded-1,unbounded})\n\\pmod{2},\n\\]\nproving the desired congruence.\n\nTo prove the desired result, we must now check that\n$F_{0,unbounded}, F_{1,unbounded}$ are odd and $F_{2,unbounded}, \\dots, F_{2unbounded,unbounded}$ are even.\nFor $emptiness=0,\\dots,unbounded+1$, the matrix $emptymatrix$ consists of all ones,\nso its determinant is 1 if $emptiness=0,1$ and 0 otherwise.\n(Alternatively, we have $rarityfunc = emptiness!$ for $emptiness=0,\\dots,unbounded+1$,\nsince every permutation of $\\{1,\\dots,emptiness\\}$ is $unbounded$-limited.)\nFor $emptiness=unbounded+2,\\dots,2unbounded$,\nobserve that rows $unbounded$ and $unbounded+1$ of $emptymatrix$  both consist of all ones,\nso $\\det(emptymatrix) = 0$ as desired.\n\n\\textbf{Third solution:} (by Tom Belulovich)\nDefine $emptymatrix$ as in the second solution. We prove\n$\\det(emptymatrix)$ is odd for $emptiness \\equiv 0,1 \\pmod{2unbounded+1}$ and even otherwise,\nby directly determining whether or not $emptymatrix$ is invertible as a matrix\nover the field of two elements.\n\nLet $columnar$ denote row $outermost$ of $emptymatrix$.\nWe first check that if $emptiness \\equiv 2, \\dots, 2unbounded \\pmod{2unbounded+1}$, then $emptymatrix$\nis not invertible. In this case, we can find integers $0 \\leq a < b \\leq unbounded$\nsuch that $emptiness + a + b \\equiv 0 \\pmod{2unbounded+1}$.\nPut $innermost = (emptiness+a+b)/(2unbounded+1)$. We can then write the\nall-ones vector both as\n\\[\n\\sum_{outermost=0}^{innermost-1} columnar_{unbounded+1-a + (2unbounded+1)outermost}\n\\]\nand as\n\\[\n\\sum_{outermost=0}^{innermost-1} columnar_{unbounded+1-b + (2unbounded+1)outermost}.\n\\]\nHence $emptymatrix$ is not invertible.\n\nWe next check that if $emptiness \\equiv 0,1 \\pmod{2unbounded+1}$, then $emptymatrix$\nis invertible. Suppose that $steadfast_1,\\dots,steadfast_{emptiness}$ are scalars such that\n$steadfast_1 columnar_1 + \\cdots + steadfast_{emptiness} columnar_{emptiness}$ is the zero vector. The $minimums$-th coordinate\nof this vector equals $steadfast_{minimums-unbounded} + \\cdots + steadfast_{minimums+unbounded}$, where we regard\n$steadfast_{innermost}$ as zero if $innermost \\notin \\{1,\\dots,emptiness\\}$. By comparing consecutive\ncoordinates, we obtain\n\\[\nsteadfast_{minimums-unbounded} = steadfast_{minimums+unbounded+1} \\qquad (1 \\leq minimums < emptiness).\n\\]\nIn particular, the $steadfast_{innermost}$ repeat with period $2unbounded+1$.\nTaking $minimums=1,\\dots,unbounded$ further yields that\n\\[\nsteadfast_{unbounded+2} = \\cdots = steadfast_{2unbounded+1} = 0\n\\]\nwhile taking $minimums=emptiness-unbounded, \\dots,emptiness-1$ yields\n\\[\nsteadfast_{emptiness-2unbounded} =  \\dots = steadfast_{emptiness-1-unbounded} = 0.\n\\]\nFor $emptiness \\equiv 0 \\pmod{2unbounded+1}$, the latter can be rewritten as\n\\[\nsteadfast_1 = \\cdots = steadfast_{unbounded} = 0\n\\]\nwhereas for $emptiness \\equiv 1 \\pmod{2unbounded+1}$, it can be rewritten as\n\\[\nsteadfast_2 = \\cdots = steadfast_{unbounded+1} = 0.\n\\]\nIn either case, since we also have\n\\[\nsteadfast_1 + \\cdots + steadfast_{2unbounded+1} = 0\n\\]\nfrom the $(unbounded+1)$-st coordinate, we deduce that all of the $steadfast_{innermost}$ must be\nzero, and so $emptymatrix$ must be invertible.\n\n\\textbf{Remark:}\nThe matrices $emptymatrix$ are examples of \\emph{banded matrices},\nwhich occur frequently in numerical applications of linear algebra.\nThey are also examples of \\emph{Toeplitz matrices}."
    },
    "garbled_string": {
      "map": {
        "i": "qzxwvtnp",
        "j": "hjgrksla",
        "m": "rplqtnvx",
        "a_i": "ckzmrnwa",
        "r_i": "vhskjdpl",
        "C": "bkqvmsrt",
        "A": "gnrlpcta",
        "S": "lxwzbind",
        "\\sigma": "tbhnqkzf",
        "n": "grmwczop",
        "k": "sdjlpwne",
        "F_n,k": "vcrhstmp",
        "M_n,k": "zpfkrlwa"
      },
      "question": "Let $grmwczop$ and $sdjlpwne$ be positive integers. Say that a permutation $tbhnqkzf$ of $\\{1,2,\\dots,grmwczop\\}$ is \\emph{$sdjlpwne$-limited} if $|tbhnqkzf(qzxwvtnp) - qzxwvtnp| \\leq sdjlpwne$ for all $qzxwvtnp$. Prove that the number of $sdjlpwne$-limited permutations of $\\{1,2,\\dots,grmwczop\\}$ is odd if and only if $grmwczop \\equiv 0$ or $1$ (mod $2sdjlpwne+1$).",
      "solution": "In all solutions,\nlet $vcrhstmp_{grmwczop,sdjlpwne}$ be the number of $sdjlpwne$-limited permutations of\n$\\{1,\\dots,grmwczop\\}$. \n\n\\textbf{First solution:}\n(by Jacob Tsimerman)\nNote that any permutation is $sdjlpwne$-limited if and only if its inverse is\n$sdjlpwne$-limited. Consequently, the number of $sdjlpwne$-limited permutations of\n$\\{1,\\dots,grmwczop\\}$ is the same as the number of $sdjlpwne$-limited involutions\n(permutations equal to their inverses) of $\\{1,\\dots,grmwczop\\}$. \n\nWe use the following fact several times: the number of involutions\nof $\\{1,\\dots,grmwczop\\}$ is odd if $grmwczop=0,1$ and even otherwise. This follows from\nthe fact that non-involutions come in pairs, so the number of involutions\nhas the same parity as the number of permutations, namely $grmwczop!$. \n\nFor $grmwczop \\leq sdjlpwne+1$, all involutions are $sdjlpwne$-limited.\nBy the previous paragraph, $vcrhstmp_{grmwczop,sdjlpwne}$ is odd for $grmwczop=0,1$ and even for\n$grmwczop=2,\\dots,sdjlpwne+1$. \n\nFor $grmwczop > sdjlpwne+1$, group the  $sdjlpwne$-limited involutions into classes based on\ntheir actions on $sdjlpwne+2,\\dots,grmwczop$. Note that for $bkqvmsrt$ a class and $tbhnqkzf \\in bkqvmsrt$,\nthe set of elements of $gnrlpcta = \\{1,\\dots,sdjlpwne+1\\}$ which map into $gnrlpcta$ under\n$tbhnqkzf$ depends only on $bkqvmsrt$, not on $tbhnqkzf$. Call this set $lxwzbind(bkqvmsrt)$; then\nthe size of $bkqvmsrt$ is exactly the number of involutions of $lxwzbind(bkqvmsrt)$. Consequently,\n$|bkqvmsrt|$ is even unless $lxwzbind(bkqvmsrt)$ has at most one element.\nHowever, the element 1 cannot map out of $gnrlpcta$ because we are looking at\n$sdjlpwne$-limited involutions. Hence if $lxwzbind(bkqvmsrt)$ has one element and $tbhnqkzf \\in bkqvmsrt$,\nwe must have $tbhnqkzf(1) = 1$. Since $tbhnqkzf$ is $sdjlpwne$-limited and $tbhnqkzf(2)$ cannot belong to $gnrlpcta$, we must have $tbhnqkzf(2) = sdjlpwne+2$. By induction, for $qzxwvtnp=3,\\dots,sdjlpwne+1$, we must have  $tbhnqkzf(qzxwvtnp) = sdjlpwne+qzxwvtnp$. \n\nIf $grmwczop < 2sdjlpwne+1$, this shows that no class $bkqvmsrt$ of odd cardinality can exist,\nso $vcrhstmp_{grmwczop,sdjlpwne}$ must be even. If $grmwczop \\geq 2sdjlpwne+1$, the classes of odd cardinality\nare in bijection with $sdjlpwne$-limited involutions of $\\{2sdjlpwne+2,\\dots,grmwczop\\}$,\nso $vcrhstmp_{grmwczop,sdjlpwne}$ has the same parity as $vcrhstmp_{grmwczop-2sdjlpwne-1,sdjlpwne}$. By induction on $grmwczop$,\nwe deduce the desired result. \n\n\\textbf{Second solution:}\n(by Yufei Zhao)\nLet $zpfkrlwa_{grmwczop,sdjlpwne}$ be the $grmwczop \\times grmwczop$ matrix with\n\\[\n(zpfkrlwa_{grmwczop,sdjlpwne})_{qzxwvtnp hjgrksla} = \\begin{cases} 1 & |qzxwvtnp-hjgrksla|\\leq sdjlpwne \\\\ 0 & \\mbox{otherwise.}\n\\end{cases}\n\\]\nWrite $\\det(zpfkrlwa_{grmwczop,sdjlpwne})$ as the sum over permutations\n$tbhnqkzf$ of $\\{1,\\dots,grmwczop\\}$ of\n$(zpfkrlwa_{grmwczop,sdjlpwne})_{1\\, tbhnqkzf(1)} \\cdots (zpfkrlwa_{grmwczop,sdjlpwne})_{grmwczop\\, tbhnqkzf(grmwczop)}$\ntimes the signature of $tbhnqkzf$. Then $tbhnqkzf$ contributes $\\pm 1$\nto $\\det (zpfkrlwa_{grmwczop,sdjlpwne})$ if $tbhnqkzf$ is $sdjlpwne$-limited and 0 otherwise.\nWe conclude that\n\\[\n\\det(zpfkrlwa_{grmwczop,sdjlpwne}) \\equiv vcrhstmp_{grmwczop,sdjlpwne} \\pmod{2}.\n\\]\nFor the rest of the solution, we interpret $zpfkrlwa_{grmwczop,sdjlpwne}$ as a matrix\nover the field of two elements. We compute its determinant using\nlinear algebra modulo 2.\n\nWe first show that for $grmwczop \\geq 2sdjlpwne+1$,\n\\[\nvcrhstmp_{grmwczop,sdjlpwne} \\equiv vcrhstmp_{grmwczop-2sdjlpwne-1,sdjlpwne} \\pmod{2},\n\\]\nprovided that we interpret $vcrhstmp_{0,sdjlpwne} = 1$. We do this by\ncomputing $\\det(zpfkrlwa_{grmwczop,sdjlpwne})$ using row and column operations.\nWe will verbally describe these operations for general $sdjlpwne$,\nwhile illustrating with the example $sdjlpwne=3$.\n\nTo begin with, $zpfkrlwa_{grmwczop,sdjlpwne}$ has the following form.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 1 & 1 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 0 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 0 & \\emptyset \\\\\n1 & 1 & 1 & 1 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nIn this presentation, the first $2sdjlpwne+1$ rows and columns are shown explicitly; the remaining rows and columns are shown in a compressed format. The symbol $\\emptyset$ indicates that the unseen entries are all zeroes, while the symbol $?$ indicates that they are not. The symbol $*$ in the lower right corner represents the matrix $vcrhstmp_{grmwczop-2sdjlpwne-1,sdjlpwne}$. We will preserve the unseen structure of the matrix by only adding the first $sdjlpwne+1$ rows or columns to any of the others.\n\nWe first add row 1 to each of rows $2, \\dots, sdjlpwne+1$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 1 & 1 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nWe next add column 1 to each of columns $2, \\dots, sdjlpwne+1$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 1 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 1 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & ? & *\n\\end{array}\n\\right)\n\\]\nFor $qzxwvtnp=2$, for each of $hjgrksla=qzxwvtnp+1,\\dots,2sdjlpwne+1$ for which the $(hjgrksla, sdjlpwne+qzxwvtnp)$-entry is nonzero, add row $qzxwvtnp$ to row $hjgrksla$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 0 & 1 & 1 & ? \\\\\n0 & 0 & 1 & 1 & 0 & 1 & 1 & ? \\\\\n0 & 0 & 0 & 1 & 0 & 1 & 1 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & ? & ? & *\n\\end{array}\n\\right)\n\\]\nRepeat the previous step for $qzxwvtnp=3,\\dots,sdjlpwne+1$ in succession.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 0 & 1 & \\emptyset \\\\\n0 & 1 & 1 & 1 & 0 & 0 & 0 & ? \\\\\n0 & 0 & 1 & 1 & 0 & 0 & 0 & ? \\\\\n0 & 0 & 0 & 1 & 0 & 0 & 0 & ? \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & *\n\\end{array}\n\\right)\n\\]\nRepeat the two previous steps with the roles of the rows and columns reversed. That is, for $qzxwvtnp=2,\\dots,sdjlpwne+1$, for each of $hjgrksla=qzxwvtnp+1,\\dots,2sdjlpwne+1$ for which the $(hjgrksla, sdjlpwne+qzxwvtnp)$-entry is nonzero, add row $qzxwvtnp$ to row $hjgrksla$.\n\\[\n\\left(\n\\begin{array}{ccccccc|c}\n1 & 0 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 1 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 1 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 0 & 0 & 0 & 1 & \\emptyset \\\\\n0 & 1 & 0 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 1 & 0 & 0 & 0 & 0 & \\emptyset \\\\\n0 & 0 & 0 & 1 & 0 & 0 & 0 & \\emptyset \\\\\n\\hline\n\\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & \\emptyset & *\n\\end{array}\n\\right)\n\\]\nWe now have a block diagonal matrix in which the top left block is a $(2sdjlpwne+1) \\times (2sdjlpwne+1)$ matrix with nonzero determinant (it results from reordering the rows of the identity matrix), the bottom right block is $zpfkrlwa_{grmwczop-2sdjlpwne-1,sdjlpwne}$, and the other two blocks are zero. We conclude that\n\\[\n\\det(zpfkrlwa_{grmwczop,sdjlpwne}) \\equiv \\det(zpfkrlwa_{grmwczop-2sdjlpwne-1,sdjlpwne}) \\pmod{2},\n\\]\nproving the desired congruence.\n\nTo prove the desired result, we must now check that $vcrhstmp_{0,sdjlpwne}, vcrhstmp_{1,sdjlpwne}$ are odd and $vcrhstmp_{2,sdjlpwne}, \\dots, vcrhstmp_{2sdjlpwne,sdjlpwne}$ are even. For $grmwczop=0,\\dots,sdjlpwne+1$, the matrix $zpfkrlwa_{grmwczop,sdjlpwne}$ consists of all ones, so its determinant is 1 if $grmwczop=0,1$ and 0 otherwise. (Alternatively, we have $vcrhstmp_{grmwczop,sdjlpwne} = grmwczop!$ for $grmwczop=0,\\dots,sdjlpwne+1$, since every permutation of $\\{1,\\dots,grmwczop\\}$ is $sdjlpwne$-limited.) For $grmwczop=sdjlpwne+2,\\dots,2sdjlpwne$, observe that rows $sdjlpwne$ and $sdjlpwne+1$ of $zpfkrlwa_{grmwczop,sdjlpwne}$  both consist of all ones, so $\\det(zpfkrlwa_{grmwczop,sdjlpwne}) = 0$ as desired.\n\n\\textbf{Third solution:} (by Tom Belulovich)\nDefine $zpfkrlwa_{grmwczop,sdjlpwne}$ as in the second solution. We prove $\\det(zpfkrlwa_{grmwczop,sdjlpwne})$ is odd for $grmwczop \\equiv 0,1 \\pmod{2sdjlpwne+1}$ and even otherwise, by directly determining whether or not $zpfkrlwa_{grmwczop,sdjlpwne}$ is invertible as a matrix over the field of two elements.\n\nLet $vhskjdpl_{qzxwvtnp}$ denote row $qzxwvtnp$ of $zpfkrlwa_{grmwczop,sdjlpwne}$. We first check that if $grmwczop \\equiv 2, \\dots, 2sdjlpwne \\pmod{2sdjlpwne+1}$, then $zpfkrlwa_{grmwczop,sdjlpwne}$ is not invertible. In this case, we can find integers $0 \\leq a < b \\leq sdjlpwne$ such that $grmwczop + a + b \\equiv 0 \\pmod{2sdjlpwne+1}$. Put $hjgrksla = (grmwczop+a+b)/(2sdjlpwne+1)$. We can then write the all-ones vector both as\n\\[\n\\sum_{qzxwvtnp=0}^{hjgrksla-1} vhskjdpl_{sdjlpwne+1-a + (2sdjlpwne+1)qzxwvtnp}\n\\]\nand as\n\\[\n\\sum_{qzxwvtnp=0}^{hjgrksla-1} vhskjdpl_{sdjlpwne+1-b + (2sdjlpwne+1)qzxwvtnp}.\n\\]\nHence $zpfkrlwa_{grmwczop,sdjlpwne}$ is not invertible.\n\nWe next check that if $grmwczop \\equiv 0,1 \\pmod{2sdjlpwne+1}$, then $zpfkrlwa_{grmwczop,sdjlpwne}$ is invertible. Suppose that $ckzmrnwa_1,\\dots,ckzmrnwa_{grmwczop}$ are scalars such that $ckzmrnwa_1 vhskjdpl_1 + \\cdots + ckzmrnwa_{grmwczop} vhskjdpl_{grmwczop}$ is the zero vector. The $rplqtnvx$-th coordinate of this vector equals $ckzmrnwa_{rplqtnvx-sdjlpwne} + \\cdots + ckzmrnwa_{rplqtnvx+sdjlpwne}$, where we regard $ckzmrnwa_{qzxwvtnp}$ as zero if $qzxwvtnp \\notin \\{1,\\dots,grmwczop\\}$. By comparing consecutive coordinates, we obtain\n\\[\nckzmrnwa_{rplqtnvx-sdjlpwne} = ckzmrnwa_{rplqtnvx+sdjlpwne+1} \\qquad (1 \\leq rplqtnvx < grmwczop).\n\\]\nIn particular, the $ckzmrnwa_{qzxwvtnp}$ repeat with period $2sdjlpwne+1$. Taking $rplqtnvx=1,\\dots,sdjlpwne$ further yields that\n\\[\nckzmrnwa_{sdjlpwne+2} = \\cdots = ckzmrnwa_{2sdjlpwne+1} = 0\n\\]\nwhile taking $rplqtnvx=grmwczop-sdjlpwne, \\dots,grmwczop-1$ yields\n\\[\nckzmrnwa_{grmwczop-2sdjlpwne} =  \\dots = ckzmrnwa_{grmwczop-1-sdjlpwne} = 0.\n\\]\nFor $grmwczop \\equiv 0 \\pmod{2sdjlpwne+1}$, the latter can be rewritten as\n\\[\nckzmrnwa_1 = \\cdots = ckzmrnwa_{sdjlpwne} = 0\n\\]\nwhereas for $grmwczop \\equiv 1 \\pmod{2sdjlpwne+1}$, it can be rewritten as\n\\[\nckzmrnwa_2 = \\cdots = ckzmrnwa_{sdjlpwne+1} = 0.\n\\]\nIn either case, since we also have\n\\[\nckzmrnwa_1 + \\cdots + ckzmrnwa_{2sdjlpwne+1} = 0\n\\]\nfrom the $(sdjlpwne+1)$-st coordinate, we deduce that all of the $ckzmrnwa_{qzxwvtnp}$ must be zero, and so $zpfkrlwa_{grmwczop,sdjlpwne}$ must be invertible.\n\n\\textbf{Remark:}\nThe matrices $zpfkrlwa_{grmwczop,sdjlpwne}$ are examples of \\emph{banded matrices}, which occur frequently in numerical applications of linear algebra. They are also examples of \\emph{Toeplitz matrices}."
    },
    "kernel_variant": {
      "question": "Let n and k be positive integers.  A permutation  π  of the set  {0,1,…,n−1}  is called k-near if\n      |π(i)−i| ≤ k   for every 0 ≤ i ≤ n−1.\nDenote by G_{n,k} the number of k-near permutations of {0,1,…,n−1}.\nShow that\n      G_{n,k} is odd  ⇔  n ≡ 0 or 1  (mod 2k+1).",
      "solution": "Throughout we work modulo 2, i.e. we only care about the parity (even/oddness) of the counted sets.\n\n1.  Reduction to involutions.\n   Let H_{n,k} be the number of k-near involutions (permutations equal to their own inverse) of {0,…,n−1}.  If σ is k-near, so is σ^{−1}.  Whenever σ ≠ σ^{−1} the two permutations form an inverse pair whose total contribution to G_{n,k} is 0 (mod 2).  Hence\n          G_{n,k} ≡ H_{n,k}.                          (1)\n   It suffices to determine the parity of H_{n,k}.\n\n2.  Parity of all involutions on an n-set.\n   On an n-element set every non-involution is paired with its inverse, so the parity of the number of involutions equals the parity of n!.  Consequently\n          #involutions on n points ≡ 1   if n = 0 or 1,\n                                    ≡ 0   if n ≥ 2.           (2)\n\n3.  The easy range  n ≤ k+1.\n   For n ≤ k+1 every permutation is automatically k-near.  Hence H_{n,k} equals the total number of involutions on n points, so by (2)\n          H_{0,k} = H_{1,k} = 1,   while   H_{n,k} = 0  for 2 ≤ n ≤ k+1.   (3)\n\n4.  Decomposing the set for n ≥ k+2.\n   Fix n ≥ k+2 and partition the ground set into\n          A = {0,1,…,k}   (size k+1)  and   B = {k+1,…,n−1}  (size n−k−1).\n   Choose a k-near involution σ and keep its action on B fixed; all involutions that agree with σ on B form a class C.  Within C everything is fixed except the freedom to permute\n          S(C) := A ∩ σ^{−1}(A)  ⊆ A.\n   Therefore |C| equals the number of involutions on |S(C)| points, and by (2)\n          |C| is odd  ⇔  |S(C)| ≤ 1.                     (4)\n\n5.  Which classes can be odd?\n   First note that |S(C)| ≠ 0.  Indeed, if no element of A is mapped to A, then σ(0) ≥ k+1, contradicting |σ(0)−0| ≤ k.  Hence |S(C)| = 1 in every odd class, and the unique element of S(C) must be 0 (if some i>0 were fixed instead, then σ(0) ≥ i+k+1 > k).\n\n   With 0 fixed, k-nearness forces the remaining k elements of A to pair in the unique way\n          i ↔ i+k     for 1 ≤ i ≤ k.                    (5)\n   Thus the 2k+1 points {0,1,…,k,k+1,…,2k} are completely prescribed.  Let\n          R = n − (2k+1).\n   The elements not yet mentioned constitute a set of size R, and σ may act on them by an arbitrary k-near involution.  Conversely, any k-near involution on those R points extends uniquely to a k-near involution of the whole set by adding the fixed point 0 and the k forced pairs in (5).\n\n   Hence the set of odd classes is in bijection with the set of k-near involutions on R points, so\n          H_{n,k} ≡ H_{R,k} = H_{n−(2k+1),k}    for all n ≥ 2k+1.   (6)\n\n6.  Completing the base cases  k+2 ≤ n ≤ 2k.\n   When k+2 ≤ n ≤ 2k we still have n ≥ k+2, so the above decomposition applies.  Suppose, for contradiction, that an odd class exists.  Then |S(C)| = 1 and 0 is fixed.  Relation (5) forces the k distinct values σ(1),…,σ(k) to lie in B.  But\n          |B| = n − k − 1 < (2k) − k − 1 = k − 1   (since n ≤ 2k),\n   which is impossible.  Hence no odd class exists and\n          H_{n,k} is even for  k+2 ≤ n ≤ 2k.           (7)\n\n7.  Induction on n with step 2k+1.\n   Combine (3), (7) and the recurrence (6).  The initial block of length 2k+1 reads\n          n = 0,1 :  H_{n,k} odd;    n = 2,…,2k :  H_{n,k} even.\n   Relation (6) shows that adding 2k+1 to n preserves the current parity of H_{n,k}.  By induction on the quotient ⌊n/(2k+1)⌋ we get\n          H_{n,k} is odd  ⇔  n ≡ 0 or 1 (mod 2k+1).    (8)\n\n8.  Returning to G_{n,k}.\n   Equality (1) transfers (8) to G_{n,k}, proving\n          G_{n,k} is odd  exactly when  n ≡ 0 or 1 (mod 2k+1).  ■",
      "_meta": {
        "core_steps": [
          "Pass to parity: modulo 2 the number of k-limited permutations equals the number of k-limited involutions (use σ↦σ⁻¹ pairing).",
          "Fact: an m-element set has an odd number of involutions iff m=0 or 1 (non-involutions pair up).",
          "Fix the first k+1 positions A; partition k-limited involutions by their action outside A.  A class is odd ⇔ the set S(C)⊆A mapped inside A has ≤1 element.",
          "This forces a specific pattern on A, giving a bijection and the recursion F_{n,k}≡F_{n-(2k+1),k} (parity preserved when n drops by 2k+1).",
          "Use base cases n≤k+1 (computed directly) and apply the recursion to conclude F_{n,k} is odd exactly when n≡0 or 1 mod (2k+1)."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "Indexing convention for the ground set; any consecutive integer set works.",
            "original": "{1,2,…,n}"
          },
          "slot2": {
            "description": "Location of the size-(k+1) window A; could be the last k+1 positions or any fixed block bordering the edge.",
            "original": "A = {1,…,k+1}"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "proof",
  "iteratively_fixed": true
}