# Find all possible numbers with specific mean, median and range

Given that there are $20$ positive numbers and that the median is $42$, mean is $46$ and the range is $35$. An important condition, I missed: A number can appear at the most two times.

This was indeed question asked in my sister's class (6th grade). She solved it by setting

$$x_1, x_2, x_9 \dots 42, 42, y_1, y_2 \dots y_9$$ and found three solutions and got her assignment correct.

The values she got was

$$30, 30, 31, 31, 32, 32, 33, 33, 34, 42, 42, 43, 61, 62, 63, 63, 64, 64, 65, 65$$

$$30, 30, 31, 31, 32, 32, 33, 33, 34, 42, 42, 55, 55, 56, 63, 63, 64, 64, 65, 65$$

$$30, 30, 31, 31, 32, 32, 33, 33, 34, 42, 42, 51, 54, 62, 63, 63, 64, 64, 65, 65$$

I looked at this question and seemed interesting to ask what are all possible solutions?

I am therefore seeking an approach to find all possible solutions.

I attempted by listing a possibility (there could be more)

$$x, x, x_1, x_2, x_3, x_4, x_5, x_6, x_7, 42, 42, y_7, y_6, y_5, y_4, y_3, y_2, x_1, x+3, x+35$$

where $x_i < 42,$ and $y_i > 42$ and $7 < x < 42$

By doing a little more work, I could come with the smallest value of $x=29$. Is that correct?

-
Didyou intended to say the median, not the mode, is 42? – Chris K. Caldwell May 3 '12 at 23:41
Are you also assuming all these numbers are integers? – Gerry Myerson May 3 '12 at 23:42
Yes, sorry the median is $42$ and they are all positive integers. – Siddhi V Iyer May 3 '12 at 23:45
Is this a counterexample to your conjecture that $x \ge 29$? $23, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 45, 55, 55, 56, 56, 57, 57, 58, 58$. If I've understood the problem correctly, I think this is the smallest possible value of $x$. – Rahul May 4 '12 at 0:52
I just chose the sequence to be $x, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, x + 31, x + 32, x + 32, x + 33, x + 33, x + 34, x + 34, x + 35, x + 35$, and found the smallest integer values of $x$ whose mean would be at least $46$. I then decreased the second half of the sequence to make the mean equal $46$. – Rahul May 4 '12 at 0:55

If we want the lowest element $x$ to be as small as possible while still keeping the mean fixed, then all the other elements should be as large as possible. However, the middle two elements are fixed at $42$. (They could be, say, $41$ and $43$, but one can verify that this doesn't improve the solution.) So, given that not more than two elements can be the same, the sequence should look something like this: $$x, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, y-4, y-3, y-3, y-2, y-2, y-1, y-1, y, y$$ The range is specified to be $35$, so $y = x + 35$, which gives us $$x, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, x+31, x+32, x+32, x+33, x+33, x+34, x+34, x+35, x+35$$ What this is, is the largest possible sequence which starts at $x$ and satisfies the conditions on the median and range. Any other sequence starting at $x$ cannot have elements larger than this. In particular, the mean of any sequence starting at $x$ is at most the mean of this sequence, which is $\frac1{20}(699 + 10x)$.

Now we want the mean to be $46$. So $46 = \text{mean} \le \frac1{20}(699 + 10x)$, or $x \ge 22.1$. As $x$ must be an integer, we set $x = 23$, getting the maximum possible sequence as $$23, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 54, 55, 55, 56, 56, 57, \ 57, 58, 58$$ whose mean is $46 \frac9{20}$. Then we just subtract $9$ from a convenient element to get the mean we want: $$23,38,38,39,39,40,40,41,41,42,42,45,55,55,56,56,57,57,58,58$$

-
The largest value of $x$ is $37$ right? – Siddhi V Iyer May 4 '12 at 20:15
Where did you get $37$ from? I wrote $x = 23$ in my answer, and the final sequence starts from $23$. I don't understand what you mean. – Rahul May 4 '12 at 20:17
I am neither saying your answer is wrong, nor correcting it (I upvoted and accepted it). The minimum value of $x=23$ which is your answer and that is correct. I was saying that the maximum value of $x=37$. Looks like I have confused you. – Siddhi V Iyer May 4 '12 at 20:28
Oh, my mistake. Yes, that's probably true; any bigger than $37$ and you can't fit $8$ other numbers between it and $42$. – Rahul May 4 '12 at 20:33

19, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 54, 54, 54, 54, 54, 54, 54, 54, 54 shows the smallest number can be 19, and from the form of this solution it's clear it can't be less.

EDIT: This is if we read the problem too fast and don't notice the bit that says, "A number can appear at the most two times."

-
But a number can only appear at most 2 times. – chris May 4 '12 at 2:05
@GerryMyerson, chris is right. A number can occur at most two times. – Siddhi V Iyer May 4 '12 at 2:21
Oops. I missed that condition. – Gerry Myerson May 4 '12 at 3:16