Call a subset of \emph{mediocre} if it has the following property:
Whenever and are elements of whose average is an integer, that average is also
an element of . Let be the number of mediocre subsets of .
[For instance, every subset of except is mediocre, so .]
Find all positive integers such that .
Solution
The answer is for some integer .
There is a bijection between mediocre subsets of and
mediocre subsets of given by adding to each
element of the subset; thus is the number of mediocre
subsets of that contain . It follows that
is the difference
between the number of mediocre subsets of containing
and the number of mediocre subsets of containing
. This difference is precisely the number of mediocre subsets of
containing both and , which we term
"mediocre subsets containing the endpoints." Since
itself is a mediocre subset of itself containing the endpoints, it
suffices to prove that this is the only mediocre subset of
containing the endpoints if and only if for
some .
If is not of the form , then we can write for
odd . In this case, the set
is a mediocre subset of containing the endpoints: the
average of and , namely , is
an integer if and only if is even, in which case this average
lies in the set.
It remains to show that if , then the only mediocre subset of
containing the endpoints is itself. This is readily
seen by induction on . For , the statement is obvious. For
general , any mediocre subset of
containing and must also contain their average, .
By the induction assumption, the only mediocre subset of
containing the endpoints is itself, and so
must contain all integers between and . Similarly, a
mediocre subset of containing the endpoints
gives a mediocre subset of containing the
endpoints by subtracting from each element. By the induction
assumption again, it follows that must contain all integers between
and . Thus and the induction
is complete.