Spoiler for Another way to look at it

1. We form all possible sequences of 40 cases (39 empty and 1 with the treasure).

2. Then we remove all sequences, where treasure is in the middle (1 < case# < 40). In other words we retain only sequences with treasure in case #1 or case #40.

3. Finally we ask what kind of sequences are more frequent among retained: those with treasure in case #1 or those with treasure in case #40.

It should be obvious that both types of sequences are equally frequent, since there is an obvious 1-1 correspondence between those two sets.

(k-man nicely proved the same by counting cardinality of both sets and showing their equality.)

2. Then we remove all sequences, where treasure is in the middle (1 < case# < 40). In other words we retain only sequences with treasure in case #1 or case #40.

3. Finally we ask what kind of sequences are more frequent among retained: those with treasure in case #1 or those with treasure in case #40.

It should be obvious that both types of sequences are equally frequent, since there is an obvious 1-1 correspondence between those two sets.

(k-man nicely proved the same by counting cardinality of both sets and showing their equality.)