|
In case anyone is curious how you would solve this manually, here it is. In what follows assume all lists are sorted from low to high. For a list of just one or two integers the median and mean are the same so we can rule those out. For a list of 3 integers the average is their sum divided by 3. But 3 times the average we want (3.75) is 11.25 which is not an integer. That eliminates lists of length 3. On to lists of length 4. In a sorted list of length 4 the median is the average of the middle two numbers. The only pairs of 2 positive integers that average 2 are {2, 2} and {1, 3}. That gives us these templates for possible lists: {a, 1, 3, b}
{a, 2, 2, b}
Remember, these are sorted and they are positive integers. In the first then the only possible value for a is 1. In the second a could be 1 or 2. Our templates are now {1, 1, 3, b}
{1, 2, 2, b}
{2, 2, 2, b}
For 4 positive integers to have a mean of 3.75 their sum must be 15. Setting b to make the sums 15 we get these as the possible solutions: {1, 1, 3, 10}
{1, 2, 2, 10}
{2, 2, 2, 9}
A quick glance to make sure that the 4th number didn't end up smaller than the 3rd number, and we are done. |