When a group of people need to decide a winner or leader between them, one approach would be that a random hidden integer is chosen with uniform distribution on $\{0, 1, ..., n\}$ and all $p$ participants publicly choose a number.
Then, the number is revealed and the participant who was the closest wins.
A variant of this happens when we introduce what is informally known as the 'price is right' rule, where you only win when you aren't going over (so the one who is the closest from the bottom wins).
Now I am having trouble formalizing the optimal strategy for games like this in my head, and even more so for how the rules would change when the 'price is right' variant is introduced.
An interesting problem!
The case of $p = 2$ is fairly straightforward. For simplicity, suppose that each player must choose a real number in $[0, 1]$ (ignoring integer issues) and let $x_1 \in [0, 1]$ and $x_2 \in [0, 1]$ denote the choices of the first and second player. Now, for any number $x_1$ that the first player chooses, the second player will either choose $x_1 - \epsilon$ if $x_1 < 1/2$; otherwise, $x_1 + \epsilon$ if $x > 1/2$. Effectively, the first player is dividing an interval into two parts, and the second player is choosing the larger of the two sub-intervals. Knowing this, the first player will then choose $x_1 = 1/2$ and so both players have a $50\%$ chance of winning.
[Of course, this is analysis is not entirely rigorous since there is no optimal $\epsilon$. While this technical problem can be solved by discretising the choice set, I consider the continuous model to ease the analysis in the case of $p = 3$.]
The case of $p = 3$ is a bit more tricky. To solve it, begin by considering the decision of the third player and let $x_1$ and $x_2$ denote the choices of the first and second players. The choices $x_1$ and $x_2$ effectively cut the interval into three segments. Let $\Delta \equiv |x_1 - x_2|$ denote the distance between the first and second choices. The third player can then choose between one or two different strategies:
What do I mean by `large' and 'small'? Let $\text{M} = \text{max}\{x_1, |1 - x_2|\}$ denote the largest distance either $x_1$ or $x_2$ to the edge. (For example, if $x_1 = 0.2$ and $x_2 = 0.9$, then $x_2$ is closer to the edge and so $\text{M} = 1 - 0.9 = 0.1$). If the third player follows strategy $1$, then their payoff is $1/2 \Delta$. If they follow strategy $2$, then their payoff is $\text{M}$. Thus, they choose strategy $1$ if $1/2 \Delta \geq M$; and choose strategy $2$ otherwise. [Note that I am assuming that ties are broken in favour of strategy $1$.]
Given this, how will the second player choose? Given any $x_1$, the second player can either force the third player into the middle ($x_3 \in (x_1, x_2)$ or force them to choose strategy $2$. Which is better?
Key insight: It must be optimal for the second player to make the third player indifferent between these two strategies.
Heuristic Proof: If the third player strictly preferred one strategy, say strategy (1), then the second player could slightly change their strategy without inducing the third player to swap to strategy 3 in a way that improves the second player's payoff. [Draw a picture if you are not convinced!]
By indifference, we have $1/2 \Delta = M$. In other words, given any $x_1$, the second player chooses $2/3$ of the way between $x_1$ and the endpoint of $1$. [Again, a picture may help.] For example, if $x_1 = 0.1$, then $x_2 = 0.1 + (2/3)0.9 = 0.7$ so that $\Delta = 0.7 - 0.1 = 0.6$ and $\text{M} = 1 - 0.7 = 0.3 = 2\text{E}$.
Finally, let us consider the choice of the first player. They anticipate the subsequent players to choose fairly mechanically. For any $x_1 \leq 1/4$, the second player will choose $x_2 = x_1 + (2/3)(1-x_1)$ and the third player will choose the midpoint between $x_1$ and $x_2$. From this, it is easy to see that the first player should choose $x_1 = 1/4$. (Choosing $x_1 = 3/4$, thereby inducing the 'mirror image' scenario, would be equally good).
Bottom line: In the case of $p = 3$, equilibrium strategies induce the first player to choose $1/4$, the second to choose $3/4$ and the third to choose $1/2$. Clearly, the player who chooses last is at a disadvantage.