There is no trick.
Yes, there is – even though it is probably not intentional – and it is equivocation. First, you say:
In the problem, each envelope can contain any number.Here, you present "any number" as meaning "any number, with absolutely no restrictions." Later, however, you do place restrictions on the numbers by requiring that it be possible for a guessed third number to fall between two such "any numbers" with a probability of greater than zero:
Given any two numbers and the algorithm, there is a well-defined probability that you're right, and that probability is over 0.5.In other words, you subtly (and perhaps unknowingly) redefined "any number" to effectively mean "any number within a finite range."
This is why you have to be very careful in the wording to even get a well-defined problem.... Prior to the numbers and algorithm, the probability of your being right is undefined and undefinable.Precisely. Prior to the numbers and the algorithm, the probability of your being right is undefinable. How, then, did you arrive at a concrete statement about that probability? You redefined the problem to make it possible. You did it while explaining the "numbers and the algorithm," which made it harder to see, but you did do it.
I'll say it again: The problem you originally presented and the problem you ultimately analyzed are not the same. The original problem's numbers were free of restrictions, but the analyzed problem's numbers were not. Two different problems.