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.

Friday, 12 March 2021

Dice

Imagine you try to simulate a single six-sided die roll by rolling a large number of die, using the following system: 1. Roll a die 2. Check what number appears the most frequent 3. If there is a single number, take that number 4. If there is a tie, scrap both and continue.

For example, if you roll

132 ⚀’s, 144 ⚁’s, 120 ⚂’s, 97 ⚃’s, 101 ⚄’s and 118 ⚅’s

Then your result is ⚁ cause 144 is the highest.

If you roll 144 ⚀’s, 144 ⚁’s, 120 ⚂’s, 97 ⚃’s, 101 ⚄’s and 118 ⚅’s

Then ⚀ and ⚁ tie, so they are scrapped, so the highest remaining is ⚂.

The question now is the following:

For what number of dice (n) is this method: 1. Well defined 2. Does it produce the numbers 1 to 6 with equal chance

and does this work for dice with other than 6 sides?

First off, the fact that it produces all number with equal chance can be explained by a simple isomorphism argument.

The only thing that is needed to proof this is well defined, is to make sure that not all numbers are tied. There are different ways in which the frequencies can all tie, namely

2-2-2 tie, for example 0x⚀ 0x⚁ 1x⚂ 1x⚃ 3x⚄ 3x⚅ (roll: ⚂⚃⚄⚄⚄⚅⚅⚅ for 8 dice) 2-4 tie, for example 1x⚄ 1x⚅ (roll:⚄⚅ for 2 dice) 3-3 tie for example 1x⚃,1x⚄,1x⚅ (roll: ⚃⚄⚅ for 3 dice)

But for the first two ties, this can only happen if the number of die is a multiple of 2, and for the last die, this can only happen if this is a multiple of 3.

This means that if the number of die is not a multiple of 2 or 3, the frequencies cannot tie.

The argument in the other direction is similar. If n is a multiple of 2, then n/2 fives and n/2 sixes will tie. Same if n is a multiple of 3, then n/3 fours, fives and sixes will tie.

For all other n

n = 2,3 or 4 has a similar argument.

And for 5, and all numbers starting from 7, there is a tie of the form

2-3-x with x a positive integer that is not one (if it was one, that one die would not be tied).

And if we assign a frequency of zero to the x, this turns into the question, can be find for each positive number n two positive integers p and q such that 2p + 3q = n. Ans this is obviously true if n is not one.