Saturday 20 March 2021

Prime number sided die

Puzzle

Assume you roll 3 p-sided die, with p a prime larger than 3, and instead of looking at the individual value, you look at the sum of all three die, and the sum of the squares, and take these 2 values modulo p.

For example, if you have 7 sided die and you roll 3,4,5, then the sum is 12 and the sum of squares is 50, so the result would be (5,1), as $12\equiv 5 \pmod 7$ and $50 \equiv 1 \pmod 7$

This procedure generates p2 possible values. Proof that p2 − p of these outcomes are equally likely, and that the remaining p values also are equally likely.

Solution

For the the rest of the solution, if we use , we mean $\equiv \pmod p$

Call the values of the die a, b and c

To get the likelihood of an outcome (x, y) we have to count the number of solutions of
$$\begin{cases}a+b+c &\equiv x \\a^2+b^2+c^2 &\equiv y\end{cases}$$

Now call f(x, y) the number of solutions matching these equations

Define α :  ≡ a − x/3, β :  ≡ b − x/3, γ :  ≡ c − x/3, ω :  ≡ y/2 − x2/6

As p is coprime with 2 and 3 and prime, this is well defined.

Using these definitions, after some simple aritmatic, our equations become the following:


α + β + γ ≡ 0

α2 + β2 + γ2 ≡ 2ω

Note that for every solution that exists for these equations, there exist p in the original one, namely, one solution for every value of x. In other words, the number of solutions f(x, y), is the number of solutions for the above equation, if we state that ω :  ≡ y/2 − x2/6. Let us call this f(ω)

In our equations, γ ≡  − α − β so


α2 + β2 + ( − α − β)2 ≡ 2ω


2α2 + 2β2 + 2αβ ≡ 2ω


α2 + β2 + αβ ≡ ω

This is a quadratic equation in α, and thus, The number of solutions for a given β is determined by the determinant:


D ≡  − 3β2 + ω

Call Θ(d) a function that is the number of solutions that x2 ≡ d has. This function can be refined in detail using Eulers Criteria, but in essence, this function is always 0 or 2, except when d = 0, then it is one. This function also has the nice property that Θ(r) = 2 ⇒ Θ(d) = Θ(rd)

The total number of possible solutions for different β can now be stated as


βΘ( − 3β2 + ω)

Now assume that ω is nonzero.

Now as p is an odd prime, we can always find an n such that
ω ≡ 4n

Now define ξ ≡ b/2n.

As there exists one β for each ξ, so the number of solutions for ξ is equal to the number of solutions for β.


ξΘ((1 − 3ξ2)4n) = ∑ξΘ((1 − 3ξ2))

So the counting function is independent on the value of ω as long as it is not zero. This makes up p2 − p of original cases.

Now assume ω is zero.


βΘ( − 3β2) = ∑βΘ( − 3) = pΘ( − 3)

So this counting function is also constant if ω is p, which makes the other p cases.