{
  "index": "1997-B-1",
  "type": "NT",
  "tag": [
    "NT",
    "ALG"
  ],
  "difficulty": "",
  "question": "Let $\\{x\\}$ denote the distance between the real number $x$ and the\nnearest integer.  For each positive integer $n$, evaluate\n\\[F_n=\\sum_{m=1}^{6n-1} \\min(\\{\\frac{m}{6n}\\},\\{\\frac{m}{3n}\\}).\\]\n(Here $\\min(a,b)$ denotes the minimum of $a$ and $b$.)",
  "solution": "It is trivial to check that $\\frac{m}{6n}=\\{\\frac{m}{6n}\\}\\leq\n\\{\\frac{m}{3n}\\}$ for $1\\leq m\\leq 2n$, that\n$1-\\frac{m}{3n}=\\{\\frac{m}{3n}\\}\\leq \\{\\frac{m}{6n}\\}$ for $2n\\leq\nm\\leq 3n$, that $\\frac{m}{3n}-1=\\{\\frac{m}{3n}\\}\\leq \\{\\frac{m}{6n}\\}$\nfor $3n\\leq m\\leq 4n$, and that $1-\\frac{m}{6n}=\\{\\frac{m}{6n}\\}\\leq\n\\{\\frac{m}{3n}\\}$ for $4n\\leq m\\leq 6n$.  Therefore the desired sum is\n\\begin{gather*}\n\\sum_{m=1}^{2n-1} \\frac{m}{6n}\n +\\sum_{m=2n}^{3n-1} \\left(1-\\frac{m}{3n} \\right) \\\\\n +\\sum_{m=3n}^{4n-1} \\left(\\frac{m}{3n}-1 \\right) + \\sum_{m=4n}^{6n-1} \\left(\n1-\\frac{m}{6n} \\right)\n=n.\n\\end{gather*}",
  "vars": [
    "x",
    "m",
    "n",
    "F_n"
  ],
  "params": [],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "x": "realvar",
        "m": "indexm",
        "n": "posintn",
        "F_n": "sumvalue"
      },
      "question": "Let $\\{realvar\\}$ denote the distance between the real number $realvar$ and the\nnearest integer.  For each positive integer $posintn$, evaluate\n\\[sumvalue=\\sum_{indexm=1}^{6posintn-1} \\min(\\{\\frac{indexm}{6posintn}\\},\\{\\frac{indexm}{3posintn}\\}).\\]\n(Here $\\min(a,b)$ denotes the minimum of $a$ and $b$.)",
      "solution": "It is trivial to check that $\\frac{indexm}{6posintn}=\\{\\frac{indexm}{6posintn}\\}\\leq\n\\{\\frac{indexm}{3posintn}\\}$ for $1\\leq indexm\\leq 2posintn$, that\n$1-\\frac{indexm}{3posintn}=\\{\\frac{indexm}{3posintn}\\}\\leq \\{\\frac{indexm}{6posintn}\\}$ for $2posintn\\leq\nindexm\\leq 3posintn$, that $\\frac{indexm}{3posintn}-1=\\{\\frac{indexm}{3posintn}\\}\\leq \\{\\frac{indexm}{6posintn}\\}$\nfor $3posintn\\leq indexm\\leq 4posintn$, and that $1-\\frac{indexm}{6posintn}=\\{\\frac{indexm}{6posintn}\\}\\leq\n\\{\\frac{indexm}{3posintn}\\}$ for $4posintn\\leq indexm\\leq 6posintn$.  Therefore the desired sum is\n\\begin{gather*}\n\\sum_{indexm=1}^{2posintn-1} \\frac{indexm}{6posintn}\n +\\sum_{indexm=2posintn}^{3posintn-1} \\left(1-\\frac{indexm}{3posintn} \\right) \\\\\n +\\sum_{indexm=3posintn}^{4posintn-1} \\left(\\frac{indexm}{3posintn}-1 \\right) + \\sum_{indexm=4posintn}^{6posintn-1} \\left(\n1-\\frac{indexm}{6posintn} \\right)\n=posintn.\n\\end{gather*}"
    },
    "descriptive_long_confusing": {
      "map": {
        "x": "waterfall",
        "m": "sandpaper",
        "n": "avalanche",
        "F_n": "puzzlement"
      },
      "question": "Let $\\{waterfall\\}$ denote the distance between the real number $waterfall$ and the\nnearest integer.  For each positive integer $avalanche$, evaluate\n\\[puzzlement=\\sum_{sandpaper=1}^{6avalanche-1} \\min(\\{\\frac{sandpaper}{6avalanche}\\},\\{\\frac{sandpaper}{3avalanche}\\}).\\]\n(Here $\\min(a,b)$ denotes the minimum of $a$ and $b$.)",
      "solution": "It is trivial to check that $\\frac{sandpaper}{6avalanche}=\\{\\frac{sandpaper}{6avalanche}\\}\\leq\n\\{\\frac{sandpaper}{3avalanche}\\}$ for $1\\leq sandpaper\\leq 2avalanche$, that\n$1-\\frac{sandpaper}{3avalanche}=\\{\\frac{sandpaper}{3avalanche}\\}\\leq \\{\\frac{sandpaper}{6avalanche}\\}$ for $2avalanche\\leq\nsandpaper\\leq 3avalanche$, that $\\frac{sandpaper}{3avalanche}-1=\\{\\frac{sandpaper}{3avalanche}\\}\\leq \\{\\frac{sandpaper}{6avalanche}\\}$\nfor $3avalanche\\leq sandpaper\\leq 4avalanche$, and that $1-\\frac{sandpaper}{6avalanche}=\\{\\frac{sandpaper}{6avalanche}\\}\\leq\n\\{\\frac{sandpaper}{3avalanche}\\}$ for $4avalanche\\leq sandpaper\\leq 6avalanche$.  Therefore the desired sum is\n\\begin{gather*}\n\\sum_{sandpaper=1}^{2avalanche-1} \\frac{sandpaper}{6avalanche}\n +\\sum_{sandpaper=2avalanche}^{3avalanche-1} \\left(1-\\frac{sandpaper}{3avalanche} \\right) \\\\\n +\\sum_{sandpaper=3avalanche}^{4avalanche-1} \\left(\\frac{sandpaper}{3avalanche}-1 \\right) + \\sum_{sandpaper=4avalanche}^{6avalanche-1} \\left(\n1-\\frac{sandpaper}{6avalanche} \\right)\n=avalanche.\n\\end{gather*}"
    },
    "descriptive_long_misleading": {
      "map": {
        "x": "imaginaryval",
        "m": "fixedindex",
        "n": "forevercount",
        "F_n": "gapfunction"
      },
      "question": "Let $\\{imaginaryval\\}$ denote the distance between the real number $imaginaryval$ and the\nnearest integer.  For each positive integer $forevercount$, evaluate\n\\[gapfunction=\\sum_{fixedindex=1}^{6forevercount-1} \\min(\\{\\frac{fixedindex}{6forevercount}\\},\\{\\frac{fixedindex}{3forevercount}\\}).\\]\n(Here $\\min(a,b)$ denotes the minimum of $a$ and $b$.)",
      "solution": "It is trivial to check that $\\frac{fixedindex}{6forevercount}=\\{\\frac{fixedindex}{6forevercount}\\}\\leq\n\\{\\frac{fixedindex}{3forevercount}\\}$ for $1\\leq fixedindex\\leq 2forevercount$, that\n$1-\\frac{fixedindex}{3forevercount}=\\{\\frac{fixedindex}{3forevercount}\\}\\leq \\{\\frac{fixedindex}{6forevercount}\\}$ for $2forevercount\\leq\nfixedindex\\leq 3forevercount$, that $\\frac{fixedindex}{3forevercount}-1=\\{\\frac{fixedindex}{3forevercount}\\}\\leq \\{\\frac{fixedindex}{6forevercount}\\}$\nfor $3forevercount\\leq fixedindex\\leq 4forevercount$, and that $1-\\frac{fixedindex}{6forevercount}=\\{\\frac{fixedindex}{6forevercount}\\}\\leq\n\\{\\frac{fixedindex}{3forevercount}\\}$ for $4forevercount\\leq fixedindex\\leq 6forevercount$.  Therefore the desired sum is\n\\begin{gather*}\n\\sum_{fixedindex=1}^{2forevercount-1} \\frac{fixedindex}{6forevercount}\n +\\sum_{fixedindex=2forevercount}^{3forevercount-1} \\left(1-\\frac{fixedindex}{3forevercount} \\right) \\\\\n +\\sum_{fixedindex=3forevercount}^{4forevercount-1} \\left(\\frac{fixedindex}{3forevercount}-1 \\right) + \\sum_{fixedindex=4forevercount}^{6forevercount-1} \\left(\n1-\\frac{fixedindex}{6forevercount} \\right)\n=forevercount.\n\\end{gather*}"
    },
    "garbled_string": {
      "map": {
        "x": "qzxwvtnp",
        "m": "hjgrksla",
        "n": "bfkpqzow",
        "F_n": "klqprjsn"
      },
      "question": "Let $\\{qzxwvtnp\\}$ denote the distance between the real number $qzxwvtnp$ and the\nnearest integer.  For each positive integer $bfkpqzow$, evaluate\n\\[\nklqprjsn=\\sum_{hjgrksla=1}^{6bfkpqzow-1} \\min(\\{\\frac{hjgrksla}{6bfkpqzow}\\},\\{\\frac{hjgrksla}{3bfkpqzow}\\}).\n\\]\n(Here $\\min(a,b)$ denotes the minimum of $a$ and $b$.)",
      "solution": "It is trivial to check that $\\frac{hjgrksla}{6bfkpqzow}=\\{\\frac{hjgrksla}{6bfkpqzow}\\}\\leq\n\\{\\frac{hjgrksla}{3bfkpqzow}\\}$ for $1\\leq hjgrksla\\leq 2bfkpqzow$, that\n$1-\\frac{hjgrksla}{3bfkpqzow}=\\{\\frac{hjgrksla}{3bfkpqzow}\\}\\leq \\{\\frac{hjgrksla}{6bfkpqzow}\\}$ for $2bfkpqzow\\leq\nhjgrksla\\leq 3bfkpqzow$, that $\\frac{hjgrksla}{3bfkpqzow}-1=\\{\\frac{hjgrksla}{3bfkpqzow}\\}\\leq \\{\\frac{hjgrksla}{6bfkpqzow}\\}$\nfor $3bfkpqzow\\leq hjgrksla\\leq 4bfkpqzow$, and that $1-\\frac{hjgrksla}{6bfkpqzow}=\\{\\frac{hjgrksla}{6bfkpqzow}\\}\\leq\n\\{\\frac{hjgrksla}{3bfkpqzow}\\}$ for $4bfkpqzow\\leq hjgrksla\\leq 6bfkpqzow$.  Therefore the desired sum is\n\\begin{gather*}\n\\sum_{hjgrksla=1}^{2bfkpqzow-1} \\frac{hjgrksla}{6bfkpqzow}\n +\\sum_{hjgrksla=2bfkpqzow}^{3bfkpqzow-1} \\left(1-\\frac{hjgrksla}{3bfkpqzow} \\right) \\\\\n +\\sum_{hjgrksla=3bfkpqzow}^{4bfkpqzow-1} \\left(\\frac{hjgrksla}{3bfkpqzow}-1 \\right) + \\sum_{hjgrksla=4bfkpqzow}^{6bfkpqzow-1} \\left(\n1-\\frac{hjgrksla}{6bfkpqzow} \\right)\n=bfkpqzow.\n\\end{gather*}"
    },
    "kernel_variant": {
      "question": "Let $\\{x\\}$ denote the distance between the real number $x$ and the nearest integer.  For every positive integer $n$ evaluate\n\\[\nG_n\\;=\\;\\sum_{m=1}^{12n-1}\\min\\Bigl(\\Bigl\\{\\frac{m}{12n}\\Bigr\\},\\Bigl\\{\\frac{m}{6n}\\Bigr\\}\\Bigr).\n\\]",
      "solution": "Write\n\\[\nA_m=\\bigl\\{\\tfrac{m}{12n}\\bigr\\},\\qquad B_m=\\bigl\\{\\tfrac{m}{6n}\\bigr\\}\\quad(1\\le m\\le12n-1).\n\\]\nFor a real number $t$, $\\{t\\}=t$ if $t\\le\\tfrac12$ and $\\{t\\}=1-t$ if $t\\ge\\tfrac12$.  Using the facts that $A_m\\le\\tfrac12$ for $m\\le6n$ and $B_m\\le\\tfrac12$ for $m\\le3n$ or $6n\\le m\\le9n$, the behaviour of $A_m$ and $B_m$—and hence of $\\min(A_m,B_m)$—is completely linear on the following five blocks of indices.\n\n1. $1\\le m\\le3n-1$:  $A_m=\\dfrac m{12n},\\;B_m=\\dfrac m{6n}$, so $\\min(A_m,B_m)=A_m=\\dfrac m{12n}$.\n\n2. $3n\\le m\\le4n-1$:  $A_m=\\dfrac m{12n},\\;B_m=1-\\dfrac m{6n}$, and one checks $A_m\\le B_m$, hence the minimum is $A_m$.\n\n3. $4n\\le m\\le6n-1$:  $A_m=\\dfrac m{12n},\\;B_m=1-\\dfrac m{6n}$ with $B_m\\le A_m$, so the minimum is $B_m=1-\\dfrac m{6n}$.\n\n4. $6n\\le m\\le8n-1$:  $A_m=1-\\dfrac m{12n},\\;B_m=\\dfrac{m-6n}{6n}$ and now $B_m\\le A_m$, so the minimum is $B_m=\\dfrac{m-6n}{6n}$.\n\n5. $8n\\le m\\le12n-1$:  $A_m=1-\\dfrac m{12n},\\;B_m$ equals either $\\dfrac{m-6n}{6n}$ or $1-\\dfrac{m-6n}{6n}$, but in either subcase $A_m\\le B_m$, hence the minimum is $A_m=1-\\dfrac m{12n}$.\n\nBreaking the sum into these five arithmetic pieces we compute:\n\\[\n\\begin{aligned}\n\\sum_{m=1}^{3n-1}\\frac m{12n}&=\\frac{(3n)(3n-1)}{24n}=\\frac{3n-1}8,\\\\\n\\sum_{m=3n}^{4n-1}\\frac m{12n}&=\\frac1{12n}\\cdot\\frac{n(7n-1)}2=\\frac{7n-1}{24},\\\\\n\\sum_{m=4n}^{6n-1}\\Bigl(1-\\frac m{6n}\\Bigr)&=2n-\\frac1{6n}\\,n(10n-1)=\\frac{2n+1}6,\\\\\n\\sum_{m=6n}^{8n-1}\\frac{m-6n}{6n}&=\\frac{(2n-1)n}{6n}=\\frac{2n-1}6,\\\\\n\\sum_{m=8n}^{12n-1}\\Bigl(1-\\frac m{12n}\\Bigr)&=4n-\\frac1{12n}\\,2n(20n-1)=\\frac{4n+1}6.\n\\end{aligned}\n\\]\nAdding these five results gives\n\\[\n\\frac{3n-1}8+\\frac{7n-1}{24}+\\frac{2n+1}6+\\frac{2n-1}6+\\frac{4n+1}6=2n.\n\\]\nHence for every positive integer $n$ one has\n\\[G_n=2n.\\]\n\\boxed{2n}",
      "_meta": {
        "core_steps": [
          "Partition the index set by solving {m/a n} ≤ {m/b n} and the reverse; this yields finitely many subintervals with simple linear behavior.",
          "On each subinterval, write min({m/a n},{m/b n}) as either m/(a n) or 1−m/(b n) (or m/(b n)−1, etc.), i.e. an affine function of m.",
          "Compute the arithmetic sums of those affine functions over each subinterval.",
          "Add the sub-sums; all linear and quadratic terms cancel, leaving a constant multiple of n."
        ],
        "mutable_slots": {
          "slot_den_large": {
            "description": "larger denominator appearing in the fractional parts (currently 6 in {m/6n})",
            "original": 6
          },
          "slot_den_small": {
            "description": "smaller denominator (currently 3 in {m/3n}); must divide slot_den_large and yield exactly two times smaller in the official data",
            "original": 3
          },
          "slot_upper_limit": {
            "description": "upper index of the sum, presently (slot_den_large)·n−1",
            "original": "6n−1"
          },
          "slot_boundaries": {
            "description": "the values where the two fractional parts are equal, currently multiples 2n, 3n, 4n that split the range; in general they are (slot_den_large/slot_den_small−1)·n, slot_den_small·n, (slot_den_large/slot_den_small+1)·n, etc.",
            "original": "2n, 3n, 4n"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "calculation"
}