{
  "index": "2009-B-3",
  "type": "COMB",
  "tag": [
    "COMB",
    "NT",
    "ALG"
  ],
  "difficulty": "",
  "question": "Call a subset $S$ of $\\{1, 2, \\dots, n\\}$ \\emph{mediocre} if it has the following property:\nWhenever $a$ and $b$ are elements of $S$ whose average is an integer, that average is also\nan element of $S$. Let $A(n)$ be the number of mediocre subsets of $\\{1,2,\\dots,n\\}$.\n[For instance, every subset of $\\{1,2,3\\}$ except $\\{1,3\\}$ is mediocre, so $A(3) =7$.]\nFind all positive integers $n$ such that $A(n+2) - 2A(n+1) + A(n) = 1$.",
  "solution": "The answer is $n=2^k-1$ for some integer $k\\geq 1$.\nThere is a bijection between mediocre subsets of $\\{1,\\ldots,n\\}$ and\nmediocre subsets of $\\{2,\\ldots,n+1\\}$ given by adding $1$ to each\nelement of the subset; thus $A(n+1)-A(n)$ is the number of mediocre\nsubsets of $\\{1,\\ldots,n+1\\}$ that contain $1$. It follows that\n$A(n+2)-2A(n+1)+A_n = (A(n+2)-A(n+1))-(A(n+1)-A(n))$ is the difference\nbetween the number of mediocre subsets of $\\{1,\\ldots,n+2\\}$ containing\n$1$ and the number of mediocre subsets of $\\{1,\\ldots,n+1\\}$ containing\n$1$. This difference is precisely the number of mediocre subsets of\n$\\{1,\\ldots,n+2\\}$ containing both $1$ and $n+2$, which we term\n``mediocre subsets containing the endpoints.'' Since $\\{1,\\ldots,n+2\\}$\nitself is a mediocre subset of itself containing the endpoints, it\nsuffices to prove that this is the only mediocre subset of\n$\\{1,\\ldots,n+2\\}$ containing the endpoints if and only if $n=2^k-1$ for\nsome $k$.\n\nIf $n$ is not of the form $2^k-1$, then we can write $n+1 = 2^a b$ for\nodd $b>1$. In this case, the set $\\{1+m b \\, | \\, 0 \\leq m \\leq 2^a\\}$\nis a mediocre subset of $\\{1,\\ldots,n+2\\}$ containing the endpoints: the\naverage of $1+m_1 b$ and $1+m_2 b$, namely $1+\\frac{m_1+m_2}{2} b$, is\nan integer if and only if $m_1+m_2$ is even, in which case this average\nlies in the set.\n\nIt remains to show that if $n=2^k-1$, then the only mediocre subset of\n$\\{1,\\ldots,n+2\\}$ containing the endpoints is itself. This is readily\nseen by induction on $k$. For $k=1$, the statement is obvious. For\ngeneral $k$, any mediocre subset $S$ of $\\{1,\\ldots,n+2=2^k+1\\}$\ncontaining $1$ and $2^k+1$ must also contain their average, $2^{k-1}+1$.\nBy the induction assumption, the only mediocre subset of\n$\\{1,\\ldots,2^{k-1}+1\\}$ containing the endpoints is itself, and so $S$\nmust contain all integers between $1$ and $2^{k-1}+1$. Similarly, a\nmediocre subset of $\\{2^{k-1}+1,\\ldots,2^k+1\\}$ containing the endpoints\ngives a mediocre subset of $\\{1,\\ldots,2^{k-1}+1\\}$ containing the\nendpoints by subtracting $2^{k-1}$ from each element. By the induction\nassumption again, it follows that $S$ must contain all integers between\n$2^{k-1}+1$ and $2^k+1$. Thus $S = \\{1,\\ldots,2^k+1\\}$ and the induction\nis complete.\n\n\\textbf{Remark.} One can also proceed by checking that a nonempty subset of\n$\\{1,\\dots,n\\}$ is mediocre if and only if it is an arithmetic progression\nwith odd common difference. Given this fact, the number of\nmediocre subsets of $\\{1,\\dots,n+2\\}$ containing the endpoints is seen to be\nthe number of odd factors of $n+1$, from which the desired result is evident.\n(The sequence $A(n)$ appears as sequence A124197 in the Encyclopedia of Integer Sequences.)",
  "vars": [
    "S",
    "n",
    "m",
    "m_1",
    "m_2"
  ],
  "params": [
    "A",
    "A_n",
    "k",
    "a",
    "b"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "S": "subset",
        "n": "setsize",
        "m": "indexm",
        "m_1": "indexone",
        "m_2": "indextwo",
        "A": "setcount",
        "A_n": "setcountn",
        "k": "poweridx",
        "a": "alphaidx",
        "b": "betaidx"
      },
      "question": "Call a subset $subset$ of $\\{1, 2, \\dots, setsize\\}$ \\emph{mediocre} if it has the following property:\nWhenever $alphaidx$ and $betaidx$ are elements of $subset$ whose average is an integer, that average is also\nan element of $subset$. Let $setcount(setsize)$ be the number of mediocre subsets of $\\{1,2,\\dots,setsize\\}$.\n[For instance, every subset of $\\{1,2,3\\}$ except $\\{1,3\\}$ is mediocre, so $setcount(3) =7$.]\nFind all positive integers $setsize$ such that $setcount(setsize+2) - 2setcount(setsize+1) + setcount(setsize) = 1$.",
      "solution": "The answer is $setsize=2^{poweridx}-1$ for some integer $poweridx\\geq 1$.\nThere is a bijection between mediocre subsets of $\\{1,\\ldots,setsize\\}$ and\nmediocre subsets of $\\{2,\\ldots,setsize+1\\}$ given by adding $1$ to each\nelement of the subset; thus $setcount(setsize+1)-setcount(setsize)$ is the number of mediocre\nsubsets of $\\{1,\\ldots,setsize+1\\}$ that contain $1$. It follows that\n$setcount(setsize+2)-2setcount(setsize+1)+setcountn = (setcount(setsize+2)-setcount(setsize+1))-(setcount(setsize+1)-setcount(setsize))$ is the difference\nbetween the number of mediocre subsets of $\\{1,\\ldots,setsize+2\\}$ containing\n$1$ and the number of mediocre subsets of $\\{1,\\ldots,setsize+1\\}$ containing\n$1$. This difference is precisely the number of mediocre subsets of\n$\\{1,\\ldots,setsize+2\\}$ containing both $1$ and $setsize+2$, which we term\n``mediocre subsets containing the endpoints.'' Since $\\{1,\\ldots,setsize+2\\}$\nitself is a mediocre subset of itself containing the endpoints, it\nsuffices to prove that this is the only mediocre subset of\n$\\{1,\\ldots,setsize+2\\}$ containing the endpoints if and only if $setsize=2^{poweridx}-1$ for\nsome $poweridx$.\n\nIf $setsize$ is not of the form $2^{poweridx}-1$, then we can write $setsize+1 = 2^{alphaidx} \\, betaidx$ for\nodd $betaidx>1$. In this case, the set $\\{1+indexm \\, betaidx \\, | \\, 0 \\leq indexm \\leq 2^{alphaidx}\\}$\nis a mediocre subset of $\\{1,\\ldots,setsize+2\\}$ containing the endpoints: the\naverage of $1+indexone \\, betaidx$ and $1+indextwo \\, betaidx$, namely $1+\\frac{indexone+indextwo}{2} \\, betaidx$, is\nan integer if and only if $indexone+indextwo$ is even, in which case this average\nlies in the set.\n\nIt remains to show that if $setsize=2^{poweridx}-1$, then the only mediocre subset of\n$\\{1,\\ldots,setsize+2\\}$ containing the endpoints is itself. This is readily\nseen by induction on $poweridx$. For $poweridx=1$, the statement is obvious. For\ngeneral $poweridx$, any mediocre subset $subset$ of $\\{1,\\ldots,setsize+2=2^{poweridx}+1\\}$\ncontaining $1$ and $2^{poweridx}+1$ must also contain their average, $2^{poweridx-1}+1$.\nBy the induction assumption, the only mediocre subset of\n$\\{1,\\ldots,2^{poweridx-1}+1\\}$ containing the endpoints is itself, and so $subset$\nmust contain all integers between $1$ and $2^{poweridx-1}+1$. Similarly, a\nmediocre subset of $\\{2^{poweridx-1}+1,\\ldots,2^{poweridx}+1\\}$ containing the endpoints\ngives a mediocre subset of $\\{1,\\ldots,2^{poweridx-1}+1\\}$ containing the\nendpoints by subtracting $2^{poweridx-1}$ from each element. By the induction\nassumption again, it follows that $subset$ must contain all integers between\n$2^{poweridx-1}+1$ and $2^{poweridx}+1$. Thus $subset = \\{1,\\ldots,2^{poweridx}+1\\}$ and the induction\nis complete.\n\n\\textbf{Remark.} One can also proceed by checking that a nonempty subset of\n$\\{1,\\dots,setsize\\}$ is mediocre if and only if it is an arithmetic progression\nwith odd common difference. Given this fact, the number of\nmediocre subsets of $\\{1,\\dots,setsize+2\\}$ containing the endpoints is seen to be\nthe number of odd factors of $setsize+1$, from which the desired result is evident.\n(The sequence $setcount(setsize)$ appears as sequence A124197 in the Encyclopedia of Integer Sequences.)"
    },
    "descriptive_long_confusing": {
      "map": {
        "S": "raincloud",
        "n": "starfruit",
        "m": "blackbird",
        "m_1": "sledgehammer",
        "m_2": "peppercorn",
        "A": "lighthouse",
        "A_n": "seashore",
        "k": "paintbrush",
        "a": "honeycomb",
        "b": "drumstick"
      },
      "question": "Call a subset $raincloud$ of $\\{1, 2, \\dots, starfruit\\}$ \\emph{mediocre} if it has the following property:\nWhenever $honeycomb$ and $drumstick$ are elements of $raincloud$ whose average is an integer, that average is also\nan element of $raincloud$. Let $lighthouse(starfruit)$ be the number of mediocre subsets of $\\{1,2,\\dots,starfruit\\}$.\n[For instance, every subset of $\\{1,2,3\\}$ except $\\{1,3\\}$ is mediocre, so $lighthouse(3) =7$.]\nFind all positive integers $starfruit$ such that $lighthouse(starfruit+2) - 2lighthouse(starfruit+1) + lighthouse(starfruit) = 1$.",
      "solution": "The answer is $starfruit=2^{paintbrush}-1$ for some integer $paintbrush\\geq 1$.\nThere is a bijection between mediocre subsets of $\\{1,\\ldots,starfruit\\}$ and\nmediocre subsets of $\\{2,\\ldots,starfruit+1\\}$ given by adding $1$ to each\nelement of the subset; thus $lighthouse(starfruit+1)-lighthouse(starfruit)$ is the number of mediocre\nsubsets of $\\{1,\\ldots,starfruit+1\\}$ that contain $1$. It follows that\n$lighthouse(starfruit+2)-2lighthouse(starfruit+1)+seashore = (lighthouse(starfruit+2)-lighthouse(starfruit+1))-(lighthouse(starfruit+1)-lighthouse(starfruit))$ is the difference\nbetween the number of mediocre subsets of $\\{1,\\ldots,starfruit+2\\}$ containing\n$1$ and the number of mediocre subsets of $\\{1,\\ldots,starfruit+1\\}$ containing\n$1$. This difference is precisely the number of mediocre subsets of\n$\\{1,\\ldots,starfruit+2\\}$ containing both $1$ and $starfruit+2$, which we term\n``mediocre subsets containing the endpoints.'' Since $\\{1,\\ldots,starfruit+2\\}$\nitself is a mediocre subset of itself containing the endpoints, it\nsuffices to prove that this is the only mediocre subset of\n$\\{1,\\ldots,starfruit+2\\}$ containing the endpoints if and only if $starfruit=2^{paintbrush}-1$ for\nsome $paintbrush$.\n\nIf $starfruit$ is not of the form $2^{paintbrush}-1$, then we can write $starfruit+1 = 2^{honeycomb} drumstick$ for\nodd $drumstick>1$. In this case, the set $\\{1+blackbird drumstick \\, | \\, 0 \\leq blackbird \\leq 2^{honeycomb}\\}$\nis a mediocre subset of $\\{1,\\ldots,starfruit+2\\}$ containing the endpoints: the\naverage of $1+sledgehammer drumstick$ and $1+peppercorn drumstick$, namely $1+\\frac{sledgehammer+peppercorn}{2} drumstick$, is\nan integer if and only if $sledgehammer+peppercorn$ is even, in which case this average\nlies in the set.\n\nIt remains to show that if $starfruit=2^{paintbrush}-1$, then the only mediocre subset of\n$\\{1,\\ldots,starfruit+2\\}$ containing the endpoints is itself. This is readily\nseen by induction on $paintbrush$. For $paintbrush=1$, the statement is obvious. For\ngeneral $paintbrush$, any mediocre subset $raincloud$ of $\\{1,\\ldots,starfruit+2=2^{paintbrush}+1\\}$\ncontaining $1$ and $2^{paintbrush}+1$ must also contain their average, $2^{paintbrush-1}+1$.\nBy the induction assumption, the only mediocre subset of\n$\\{1,\\ldots,2^{paintbrush-1}+1\\}$ containing the endpoints is itself, and so $raincloud$\nmust contain all integers between $1$ and $2^{paintbrush-1}+1$. Similarly, a\nmediocre subset of $\\{2^{paintbrush-1}+1,\\ldots,2^{paintbrush}+1\\}$ containing the endpoints\ngives a mediocre subset of $\\{1,\\ldots,2^{paintbrush-1}+1\\}$ containing the\nendpoints by subtracting $2^{paintbrush-1}$ from each element. By the induction\nassumption again, it follows that $raincloud$ must contain all integers between\n$2^{paintbrush-1}+1$ and $2^{paintbrush}+1$. Thus $raincloud = \\{1,\\ldots,2^{paintbrush}+1\\}$ and the induction\nis complete.\n\n\\textbf{Remark.} One can also proceed by checking that a nonempty subset of\n$\\{1,\\dots,starfruit\\}$ is mediocre if and only if it is an arithmetic progression\nwith odd common difference. Given this fact, the number of\nmediocre subsets of $\\{1,\\dots,starfruit+2\\}$ containing the endpoints is seen to be\nthe number of odd factors of $starfruit+1$, from which the desired result is evident.\n(The sequence $lighthouse(starfruit)$ appears as sequence A124197 in the Encyclopedia of Integer Sequences.)"
    },
    "descriptive_long_misleading": {
      "map": {
        "S": "emptiness",
        "n": "infinitum",
        "m": "stillness",
        "m_1": "stillnessone",
        "m_2": "stillnesstwo",
        "A": "scarcity",
        "A_n": "scarcityindex",
        "k": "shrinkage",
        "a": "totality",
        "b": "evenness"
      },
      "question": "Call a subset $emptiness$ of $\\{1, 2, \\dots, infinitum\\}$ \\emph{mediocre} if it has the following property:\nWhenever $totality$ and $evenness$ are elements of $emptiness$ whose average is an integer, that average is also\nan element of $emptiness$. Let $scarcity(infinitum)$ be the number of mediocre subsets of $\\{1,2,\\dots,infinitum\\}$.\n[For instance, every subset of $\\{1,2,3\\}$ except $\\{1,3\\}$ is mediocre, so $scarcity(3) =7$.]\nFind all positive integers $infinitum$ such that $scarcity(infinitum+2) - 2scarcity(infinitum+1) + scarcity(infinitum) = 1$.",
      "solution": "The answer is $infinitum=2^{shrinkage}-1$ for some integer $shrinkage\\geq 1$.\nThere is a bijection between mediocre subsets of $\\{1,\\ldots,infinitum\\}$ and\nmediocre subsets of $\\{2,\\ldots,infinitum+1\\}$ given by adding $1$ to each\nelement of the subset; thus $scarcity(infinitum+1)-scarcity(infinitum)$ is the number of mediocre\nsubsets of $\\{1,\\ldots,infinitum+1\\}$ that contain $1$. It follows that\n$scarcity(infinitum+2)-2scarcity(infinitum+1)+scarcityindex = (scarcity(infinitum+2)-scarcity(infinitum+1))-(scarcity(infinitum+1)-scarcity(infinitum))$ is the difference\nbetween the number of mediocre subsets of $\\{1,\\ldots,infinitum+2\\}$ containing\n$1$ and the number of mediocre subsets of $\\{1,\\ldots,infinitum+1\\}$ containing\n$1$. This difference is precisely the number of mediocre subsets of\n$\\{1,\\ldots,infinitum+2\\}$ containing both $1$ and $infinitum+2$, which we term\n``mediocre subsets containing the endpoints.'' Since $\\{1,\\ldots,infinitum+2\\}$\nitself is a mediocre subset of itself containing the endpoints, it\nsuffices to prove that this is the only mediocre subset of\n$\\{1,\\ldots,infinitum+2\\}$ containing the endpoints if and only if $infinitum=2^{shrinkage}-1$ for\nsome $shrinkage$.\n\nIf $infinitum$ is not of the form $2^{shrinkage}-1$, then we can write $infinitum+1 = 2^{totality} evenness$ for\nodd $evenness>1$. In this case, the set $\\{1+stillness\\, evenness \\, | \\, 0 \\leq stillness \\leq 2^{totality}\\}$\nis a mediocre subset of $\\{1,\\ldots,infinitum+2\\}$ containing the endpoints: the\naverage of $1+stillnessone\\, evenness$ and $1+stillnesstwo\\, evenness$, namely $1+\\frac{stillnessone+stillnesstwo}{2}\\, evenness$, is\nan integer if and only if $stillnessone+stillnesstwo$ is even, in which case this average\nlies in the set.\n\nIt remains to show that if $infinitum=2^{shrinkage}-1$, then the only mediocre subset of\n$\\{1,\\ldots,infinitum+2\\}$ containing the endpoints is itself. This is readily\nseen by induction on $shrinkage$. For $shrinkage=1$, the statement is obvious. For\ngeneral $shrinkage$, any mediocre subset $emptiness$ of $\\{1,\\ldots,infinitum+2=2^{shrinkage}+1\\}$\ncontaining $1$ and $2^{shrinkage}+1$ must also contain their average, $2^{shrinkage-1}+1$.\nBy the induction assumption, the only mediocre subset of\n$\\{1,\\ldots,2^{shrinkage-1}+1\\}$ containing the endpoints is itself, and so $emptiness$\nmust contain all integers between $1$ and $2^{shrinkage-1}+1$. Similarly, a\nmediocre subset of $\\{2^{shrinkage-1}+1,\\ldots,2^{shrinkage}+1\\}$ containing the endpoints\ngives a mediocre subset of $\\{1,\\ldots,2^{shrinkage-1}+1\\}$ containing the\nendpoints by subtracting $2^{shrinkage-1}$ from each element. By the induction\nassumption again, it follows that $emptiness$ must contain all integers between\n$2^{shrinkage-1}+1$ and $2^{shrinkage}+1$. Thus $emptiness = \\{1,\\ldots,2^{shrinkage}+1\\}$ and the induction\nis complete.\n\n\\textbf{Remark.} One can also proceed by checking that a nonempty subset of\n$\\{1,\\dots,infinitum\\}$ is mediocre if and only if it is an arithmetic progression\nwith odd common difference. Given this fact, the number of\nmediocre subsets of $\\{1,\\dots,infinitum+2\\}$ containing the endpoints is seen to be\nthe number of odd factors of $infinitum+1$, from which the desired result is evident.\n(The sequence $scarcity(infinitum)$ appears as sequence A124197 in the Encyclopedia of Integer Sequences.)"
    },
    "garbled_string": {
      "map": {
        "S": "qxvjmrlp",
        "n": "flkzoqeir",
        "m": "hsjqvnto",
        "m_1": "wprkebal",
        "m_2": "znctigoh",
        "A": "rldvwxje",
        "A_n": "zmbghwso",
        "k": "xugfdpav",
        "a": "ysrvkmeh",
        "b": "cndqlohz"
      },
      "question": "Call a subset $qxvjmrlp$ of $\\{1, 2, \\dots, flkzoqeir\\}$ \\emph{mediocre} if it has the following property:\nWhenever $ysrvkmeh$ and $cndqlohz$ are elements of $qxvjmrlp$ whose average is an integer, that average is also\nan element of $qxvjmrlp$. Let $rldvwxje(flkzoqeir)$ be the number of mediocre subsets of $\\{1,2,\\dots,flkzoqeir\\}$.\n[For instance, every subset of $\\{1,2,3\\}$ except $\\{1,3\\}$ is mediocre, so $rldvwxje(3) =7$.]\nFind all positive integers $flkzoqeir$ such that $rldvwxje(flkzoqeir+2) - 2rldvwxje(flkzoqeir+1) + rldvwxje(flkzoqeir) = 1$.",
      "solution": "The answer is $flkzoqeir=2^{xugfdpav}-1$ for some integer $xugfdpav\\geq 1$.\nThere is a bijection between mediocre subsets of $\\{1,\\ldots,flkzoqeir\\}$ and\nmediocre subsets of $\\{2,\\ldots,flkzoqeir+1\\}$ given by adding $1$ to each\nelement of the subset; thus $rldvwxje(flkzoqeir+1)-rldvwxje(flkzoqeir)$ is the number of mediocre\nsubsets of $\\{1,\\ldots,flkzoqeir+1\\}$ that contain $1$. It follows that\n$rldvwxje(flkzoqeir+2)-2rldvwxje(flkzoqeir+1)+zmbghwso = (rldvwxje(flkzoqeir+2)-rldvwxje(flkzoqeir+1))-(rldvwxje(flkzoqeir+1)-rldvwxje(flkzoqeir))$ is the difference\nbetween the number of mediocre subsets of $\\{1,\\ldots,flkzoqeir+2\\}$ containing\n$1$ and the number of mediocre subsets of $\\{1,\\ldots,flkzoqeir+1\\}$ containing\n$1$. This difference is precisely the number of mediocre subsets of\n$\\{1,\\ldots,flkzoqeir+2\\}$ containing both $1$ and $flkzoqeir+2$, which we term\n``mediocre subsets containing the endpoints.'' Since $\\{1,\\ldots,flkzoqeir+2\\}$\nitself is a mediocre subset of itself containing the endpoints, it\nsuffices to prove that this is the only mediocre subset of\n$\\{1,\\ldots,flkzoqeir+2\\}$ containing the endpoints if and only if $flkzoqeir=2^{xugfdpav}-1$ for\nsome $xugfdpav$.\n\nIf $flkzoqeir$ is not of the form $2^{xugfdpav}-1$, then we can write $flkzoqeir+1 = 2^{ysrvkmeh} cndqlohz$ for\nodd $cndqlohz>1$. In this case, the set $\\{1+hsjqvnto\\,cndqlohz \\, | \\, 0 \\leq hsjqvnto \\leq 2^{ysrvkmeh}\\}$\nis a mediocre subset of $\\{1,\\ldots,flkzoqeir+2\\}$ containing the endpoints: the\naverage of $1+wprkebal\\,cndqlohz$ and $1+znctigoh\\,cndqlohz$, namely $1+\\frac{wprkebal+znctigoh}{2}\\,cndqlohz$, is\nan integer if and only if $wprkebal+znctigoh$ is even, in which case this average\nlies in the set.\n\nIt remains to show that if $flkzoqeir=2^{xugfdpav}-1$, then the only mediocre subset of\n$\\{1,\\ldots,flkzoqeir+2\\}$ containing the endpoints is itself. This is readily\nseen by induction on $xugfdpav$. For $xugfdpav=1$, the statement is obvious. For\ngeneral $xugfdpav$, any mediocre subset $qxvjmrlp$ of $\\{1,\\ldots,flkzoqeir+2=2^{xugfdpav}+1\\}$\ncontaining $1$ and $2^{xugfdpav}+1$ must also contain their average, $2^{xugfdpav-1}+1$.\nBy the induction assumption, the only mediocre subset of\n$\\{1,\\ldots,2^{xugfdpav-1}+1\\}$ containing the endpoints is itself, and so $qxvjmrlp$\nmust contain all integers between $1$ and $2^{xugfdpav-1}+1$. Similarly, a\nmediocre subset of $\\{2^{xugfdpav-1}+1,\\ldots,2^{xugfdpav}+1\\}$ containing the endpoints\ngives a mediocre subset of $\\{1,\\ldots,2^{xugfdpav-1}+1\\}$ containing the endpoints by subtracting $2^{xugfdpav-1}$ from each element. By the induction\nassumption again, it follows that $qxvjmrlp$ must contain all integers between\n$2^{xugfdpav-1}+1$ and $2^{xugfdpav}+1$. Thus $qxvjmrlp = \\{1,\\ldots,2^{xugfdpav}+1\\}$ and the induction\nis complete.\n\n\\textbf{Remark.} One can also proceed by checking that a nonempty subset of\n$\\{1,\\dots,flkzoqeir\\}$ is mediocre if and only if it is an arithmetic progression\nwith odd common difference. Given this fact, the number of\nmediocre subsets of $\\{1,\\dots,flkzoqeir+2\\}$ containing the endpoints is seen to be\nthe number of odd factors of $flkzoqeir+1$, from which the desired result is evident.\n(The sequence $rldvwxje(flkzoqeir)$ appears as sequence A124197 in the Encyclopedia of Integer Sequences.)"
    },
    "kernel_variant": {
      "question": "Call a subset $S$ of $\\{3,4,\\dots ,m\\}$ mediocre if, whenever $a,b\\in S$ have integer average, that average also lies in $S$.  For $m\\ge 3$ let \\[B(m)=\\#\\{\\text{mediocre subsets of }\\{3,4,\\dots ,m\\}\\}.\\]\nDetermine all positive integers $n$ such that\n\\[\nB(n+3)-2B(n+2)+B(n+1)=1.\n\\]",
      "solution": "Step 1.  For m≥3 let B(m) count the mediocre subsets of {3,4,…,m}.  By the usual “shift by 1’’ bijection one shows\n  B(m+1)−B(m)=#{mediocre S⊆{3,…,m+1}:3∈S}.\nIndeed, sending each mediocre subset of {3,…,m} to its image under x↦x+1 gives all mediocre subsets of {4,…,m+1}, so the new ones are exactly those containing the new element 3.\n\nStep 2.  Hence\n  B(m+3)−2B(m+2)+B(m+1)\n  =(B(m+3)−B(m+2))−(B(m+2)−B(m+1))\n  =#{S⊆{3,…,m+3}:3∈S}−#{S⊆{3,…,m+2}:3∈S}\n  =#{mediocre S⊆{3,…,m+3}:3∈S and m+3∈S}.\n\nStep 3.  It is standard that a nonempty subset of consecutive integers is mediocre if and only if it is an arithmetic progression whose common difference is odd.  Therefore any mediocre S⊆{3,…,m+3} with 3,m+3∈S must be\n  S={3,3+d,3+2d,…,3+kd=m+3}\nwith d>0 odd and kd=m.  Conversely each odd divisor d of m gives exactly one such S.  Thus\n  B(m+3)−2B(m+2)+B(m+1)=d₋odd(m),\nwhere d₋odd(m) is the number of odd divisors of m.\n\nStep 4.  The equation\n  B(n+3)−2B(n+2)+B(n+1)=1\nbecomes d₋odd(n)=1, which holds exactly when n has no odd divisor >1, i.e. n is a power of 2.  Since B(n+1) is only defined for n+1≥3 we require n≥2.  Hence the solutions are exactly\n  n=2,4,8,16,…\nall positive powers of 2 (≥2).  This completes the solution.",
      "_meta": {
        "core_steps": [
          "First-difference trick: A(n+1)−A(n) equals the number of mediocre subsets of {1,…,n+1} that contain the left endpoint (via +1 shift bijection).",
          "Second-difference trick: A(n+2)−2A(n+1)+A(n) counts mediocre subsets of {1,…,n+2} that contain both endpoints 1 and n+2.",
          "Construction when n+1 has an odd factor >1: an arithmetic progression 1,1+b,1+2b,…,1+2^a b provides a second endpoint-containing mediocre set, so the second difference exceeds 1.",
          "Uniqueness when n+1 is a power of two: inductively show that any endpoint-containing mediocre set must successively fill the whole interval, hence the full set is the only possibility.",
          "Therefore the equation equals 1 exactly when n = 2^k − 1 (k ≥ 1)."
        ],
        "mutable_slots": {
          "slot1": {
            "description": "Actual label of the left endpoint of the ambient interval; any constant shift of all elements preserves the argument.",
            "original": 1
          },
          "slot2": {
            "description": "Size of the forward step in the finite-difference A(n+step)−2A(n+step−1)+A(n+step−2); step=2 here but any fixed step ≥2 keeps the same counting logic (it will then refer to sets containing both endpoints distance ‘step’ apart).",
            "original": 2
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "proof"
}