### Equal Averages

Comment

1. There are other sets of five positive whole numbers where mean=median=mode=range.
2. There are 33 sets where mean=median=mode=range=100

*I should mention that sets with all five numbers being distinct are not taken into account since, after exploring the web a little bit, it seems that those type of sets are considered to have no mode at all (plus it gets pretty messy if we add this type of sets as solutions). So the set {2,3,4,5,6} that was mentioned by the first commenter is not a solution.

We'll start with expressing the equations for the mean, median and range first, as they are pretty straightforward, and deal with the mode later.
So for well-ordered sets of five positive whole numbers, and where we denote mean=median=mode=range=N, we get:

1. Mean: (x1+x2+x3+x4+x5)/5=N , or x1+x2+x3+x4+x5=5N
2. Median: x3=N
3. Range: x5-x1=N, or x5=x1+N

Substitute (2) & (3) into (1) to get:
(Eq.1) 2x1+x2+x4=3N

Now let's deal with the mode. With a well-ordered set of five numbers, there are 3 possible combinations for the mode:

1. x2=x3=N, x4 and x5 may or may not be the same
2. x3=x4=N, x1 and x2 may or may not be the same
3. x2=x3=x4=N

For the first case Eq.1 becomes x4=2(N-x1). Since the set is well-ordered we can write x3<x4≤x5, or N<x4≤x1+N, or N<2(N-x1)≤x1+N. After a few algebraic manipulations on this inequality, we get N/3≤x1<N/2.
For the second case Eq.1 becomes x2=2(N-x1). After applying the same logic and math procedure as before we get, N/2<x1≤2N/3.
The third case is the simplest. Just substitute x2=x4=N (x3 is already equal N since it's the median) into Eq.1 to get, x1=N/2.

Let's summarize all the important relations:

1. x3=N
2. x5=x1+N
3. When x2=N, x1 takes positive whole values N/3≤x1<N/2 and x4=2(N-x1)
4. When x4=N, x1 takes positive whole values N/2<x1≤2N/3 and x2=2(N-x1)
5. When x2=x4=N, x1 takes positive whole value x1=N/2

Let's see two examples:

1. N=5. For the case x2=N, the inequality for x1 is 1.66≤x1<2.5, thus x1 can only take the value 2. In this case x4=2(5-2)=6, x5=2+5=7 and the set is {2,5,5,6,7} just like presented in the article.
For the case x4=N, the inequality for x1 is 2.5≤x1<3.33, thus x1 can only take the value 3. In this case x2=2(5-3)=4, x5=3+5=8 and the set is {2,4,5,5,8}.
For the case x2=x4=N, x1=5/2=2.5 which is impossible since x1 can only have integer values. This means that there is no set where the mode occurs three times.
2. Before continuing to the next example, we can notice that x1 takes the same amount of values whether x2=N or x4=N. So for example, if x1 took two values from the inequality N/3≤x1<N/2 then it will take two values from the inequality N/2<x1≤2N/3. So to count the number of solutions, we only need to consider one inequality and double the amount of values that x1 took. If N is even then we have one more solution and if N is odd then we dont. With this in mind let's continue to the second example:

3. N=100. For the case x2=N, the inequality for x1 is 33.33≤x1<50, thus x1 can only take the values 34,35,...,49, which is a total of 16 values. Double that number because from the second inequality we'll also get 16 values for x1, and add 1 because N=100 is even. So we have a total of 16+16+1=33 sets where mean=median=mode=range=100

An observation that I made is that when N is even, starting with N=2, the number of sets that satisfy mean=median=mode=range=N are:
1,1,3,3,3,5,5,5,7,7,7,9,9,9,... and so on. And for N odd, starting with N=1, we have: 0,2,2,2,4,4,4,6,6,6,8,8,8,... and so on. So clearly there is a pattern yet I'm not sure how to formulate an equation that will calculate the number of sets that satisfy mean=median=mode=range directly from the value of N. I did manage to find an algorithm though:

1. Divide N by 3 to get a number M
2. If N is even & M is not an integer, then round M to the nearest odd integer
3. If N is odd & M is not an integer, then round M to the nearest even integer
4. If M is an integer, then add 1 to M

So for example, for N=100 we have M=100/3=33.33, and the nearest odd integer is 33. For N=5, M=1.66 and so the number of solutions is 2.

When I do take into account sets where all five numbers are distinct, I get into pretty ugly mess of inequalities which seems hard to solve, so I'm not sure how to count the number of solutions in this case. I'd love to hear suggestions!

That's It! If you read up until now then thank you very much! :)
I'd love to hear some feedback!