There's nothing wrong with the theorem I showed to you. Well, I proved it, didn't I :)
So it could be wrong only if my proof were invalid!
Now let me explain how I concluded that this problem could be solved by simply
taking the HM of the two given speeds.
Let x be the time it takes in minutes to arrive on time.
To arrive five minutes late means the journey takes x+5 minutes.
To arrive five minutes early means the journey takes x-5 minutes.
We are given that if r1 = 45, t1 = x+5 and
if r2 = 63, t2 = x-5.`
So ta = ((x+5)+(x-5))/2 = x minutes, exactly the the AM of t1 and t2.
(It's immaterial whether you convert the times to hour or not.
Were t1 and t2 to be counted in hours, its AM would still be the on-time time.
Why? Because the late amount and the early amount equals, so they cancel out
when you calculate the AM. The problem poser intended it that way.)
So according to the theorem, ra should be the HM of r1 and r2.
Now back to the case of n = 3.
Were there to be a distance d, and speeds r1, r2, r3, and desired speed x
such that (t1 + t2 + t3) / 3 = x, then the AM of r1, r2, r3 would be x and
ra, the HM of the three speeds, would be the answer as well.
However, these numbers r1, r2, r3, t1, t2, t3 must have come from reality.
In a hurry I simply picked arbitrary numbers and used them in my example.
That's bad. These numbers aren't arbitrary. They're dependent on one another.
So that's why you get funny result.