I pulled out some old matchboxes from my cupboard and counted the number of matches in each. The median, mode, and mean of these counts were respectively 3, 4, and 5. What is the smallest number of matchboxes I could have found?

Stated differently, find a set of non-negative integers with the given measures of central tendency (median, mode, and mean) and the fewest number of elements.

Extension: Find sets (if possible) for each of the six assignments of {mean, median, mode} to {3,4,5}. Repeat for {2,3,4}.

Definitions:

- mean: (sum of all the elements in the set) divided by (the number of elements in the set). (arithmetic mean)
- median: the value/element which splits an ordered set into equal halves. If the set has an odd number of elements, it is the middle element; if the set has an even number of elements it is the arithmetic mean of the two middle elements.
- mode: the element in the set which occurs most often.

Solutions were received from (will be filled in).

Joseph DeVincentis sent this nice summary:

For median 3, mode 4, mean 5, use {0,1,2,4,4,19}. It is not possible to do these values in fewer numbers. Clearly 3 numbers or fewer is impossible, as there must be two 4s (or the only number is 4) and then the median is 4. Using 4 or 5 numbers also fails, because you need a number larger than 4 to get the mean up to 5, which makes the median at least 4.median 3, mode 5, mean 4: {0,1,2,3,5,5,12}

median 4, mode 3, mean 5: {3,3,5,9} [this ordering of central tendencies
is always possible as {mode, mode, 2*median-mode, 4*mean-2*median-mode}]

median 4, mode 5, mean 3: {0,1,4,5,5}

median 5, mode 3, mean 4: {0,0,3,3,3,3,5,5,5,6,6,6,7}median 5, mode 4, mean 3: I don't think this is possible. You need more
than half of the numbers to be 5 or more for the median, plus more 4s than
any other number for the mode, and the remaining numbers being 0 just cannot
pull the mean down to 3. If you are just trying to fill it with 0s, 4s, 5s,
and 6s you need over 3/4 of the numbers to be 4, 5, or 6 (say, N 5s, N 6s,
and N+1 4s) and optimally the remaining numbers are 0 (N-2 0s), and as N
gets large this only brings the mean down to 3.75. If you stick in, say, 1s
and 7s, you can have more small numbers but the 7s counteract any benefit
and at N-2 0s, N 1s, N+1 4s, N 5s, N 6s, and N 7s the mean tends to 3 5/6.
If you use even more different numbers the problem it only raises the mean.

median 2, mode 3, mean 4: {0,0,1,1,3,3,3,21}

median 2, mode 4, mean 3: {0,1,1,2,2,4,4,4,9}

median 3, mode 4, mean 2: Impossible. Only the numbers 0, 1, 2, 3, and 4 are sensible to include. An even set with middle numbers 2,4 has no chance to counterbalance all the 4s to bring the mean down to 2. So you must have a 3 (or two 3s) in the middle. At least half the numbers are 3 or more. You must have more 4s than 0s in order for the mode to be correct. You must have more total 3s and 4s as 0s and 1s in order for the median to be correct. If you pair up the numbers moving outward from the center of the sorted set, you will get some 0,4 pairs and some 1,3 pairs which have mean 2. But you will always get at least one 1,4 pair and the central 3 or 3,3 which have mean greater than 2. And nowhere is there any way to make a pair with mean less than 2.

median 4, mode 2, mean 3:
{0,0,0,0,0,2,2,2,2,2,2,4,4,4,4,4,5,5,5,5,5,6,6}

Mail to Ken