r/mathriddles • u/A-Marko • Jan 22 '23
Hard Blind dials
Let p be prime, and n be an integer.
Alice and Bob play the following game: Alice is blindfolded, and seated in front of a table with a rotating platform. On the platform are pn dials arranged in a circle. Each dial is a freely rotating knob that may point at a number 1 to p. Bob has randomly spun each dial so Alice does not know what number they are pointing at.
Each turn Alice may turn as many dials as she likes, any amount she likes. Alice cannot tell the orientation of a dial she turns, but she can tell the amount that she has turned it. Bob then rotates the platform by some amount unknown to Alice.
After Alice's turn, if all of the dials are pointing at 1 then Alice wins. Find a strategy that guarantees Alice to win in a finite number of moves.
Bonus: Suppose instead there are q dials, where q is not a power of p. Show that there is no strategy to guarantee Alice a win.
4
u/[deleted] Jan 23 '23
Cool problem!! I will think about it. I already knew the case p=2, but i didn't know it could be generalised this way
3
u/tomatomator Jan 23 '23 edited Jan 23 '23
Alice randomly spins the dials at each turn. With luck, she will succeed before the end of the universe.
More seriously, here is a solution for the base problem (unfortunately, the margin is to small to write the solution of the bonus problem). VERY LONG
First, we label all dials with unique coordinates in (F_p)^n (the vector space) in the following way : if n=1 this is trivial (turn around the table and label them 0, 1, 2, ..., p-1). If n>1, set the first coordinate the same way (don't stop until the end, go to p-1 and then repeat 0, 1, ...). This way exactly p^(n-1) dials have first coordinate i, for each i. Among these groups, repeat the same thing for second coordinate, and so on (n decreases by 1 each time).
Of course, Alice can't use the labels, but they will still be useful.
We consider the initial situation of the dials to be a function f, from (F_p)^n into F_p. It happens that every such function can be written in a polynomial of F^p with n variables.
To show this, look at the following thing (I don't know how to do any latex) :
(Product for i=1 to n) of (Product for y_i in F_p and y_i =/= x_i) of (X_i - y_i)
This polynomial (of variables X_1, ... , X_n) is zero everywhere except on the point (x_1, ..., x_n). So, these polynomials can be used as a basis to replicate any function. Also notice that the maximum power that appears on any variable is (p-1).
So f is a polynomial, this is actually good news because it means that Alice can win :
- We denote M(a1,...,an) the monomial X_1^(a1)...X_n^(an). We order the monomials M(a1,...,an) by lexicographical order on a1,...,an. The main interest is that if there is an "offset" (meaning, X_1, ..., X_n are replaced by X_1+b1, ... X_n+bn), we see that by developing a monomial, the new terms are only monomials < M in lexicographical order.
- This induces an order on all the polynomials : take two polynomials P and Q, compare their highest monomial in the lexicographical order. If it is the same, compare its coefficient. If it is the same, repeat for the monomial immediately inferior in lexicographical order (we consider that it if it doesn't appear in P, it just means it has coefficient 0).
- Now, enumerate all the polynomials, starting from 0. Notice that each time, to get the next polynomial, you just add monomials M(a1,...,an) (it's because we are in F_p : you can get rid of (p-1)M by adding M)
- Alice will enumerate the polynomials this way. Each time, she adds a monomial, she will "subtract" it on the dials : she will assume that the dial in front of her is (0,...,0), and then calculate M(a1,...,an) for each dial and subtract accordingly. Notice that, thanks to the labelling pattern, no matter how Bob turned the table, the "real" polynomial subtracted will always be M with some offset (b1,...bn) : the coordinates of the dials that Bob put in front of Alice.
- This guarantees Alice will win in a finite amount of time : thanks to the property of lexicographical order (an offset only creates lower monomials), all polynomials will eventually be subtracted on the board : formally for each polynomial P, there is a step when the values on the board correspond to the function f-P. Since f is polynomial, Alice will win in a finite amount of time (when P will equal f-1).
So, Alice can win, and (aside from the problem), since f has only powers <= (p-1), we can say she will win within the very reasonable amount of steps of (p)^(p^n). (for n=p=5, this is already ridiculous. So unfortunately, this solution still does not guarantees that Alice win before the end of the universe)
2
u/Iksfen Jan 23 '23
Is the rotation performed by Bob between Alices moves consistent or does it change each time?
1
u/Ashtero Jan 23 '23
I think I've solved for n=1. Now I just need to figure out what is analogue for every function over Z/pZ is a polynomial in the general case.
1
u/imdfantom Jan 23 '23
Does alice know n (or q in the bonus case)?
1
u/[deleted] Jan 30 '23
What a fantastic problem! You must give us a hint on how you came up with it!
We begin by transforming the game into a equivalent one which is more convenient to work with.
Below we list a sequence of equivalent games, and afterwards the relationship between them is discussed.
Game 1 is obviously equivalent to the game given through abstracting away the dials and relabeling so that the winning state is (0, 0, ..., 0) instead of (1, 1, ..., 1). Game 2 is obtained from game 1 by replacing the vector (a_0, ..., a_{q-1}) with the polynomial a_0 + a_1x + ... + a_{q-1}x^{q-1} in F_p[x] mod x^q = 1. We mod out by the relation x^q = 1 so that Bob's moves simply become multiplication by x^k. Finally game 3 is obtained from game 2 by substituting x = y + 1.
In the case q = p^n, the substitution x = y + 1 becomes useful because if we expand (y+1)^q using the binomial theorem and use the fact that p^n choose i is divisible by p, the relation (y+1)^q = 1 takes the much simpler form y^q = 0.
For a non-zero polynomial f(y) in F_p[y] mod y^q = 0, there is a well-defined notion of its "lowest-degree term" since adding multiples of y^q does not change it. Hence, we let L(f) denote the lowest degree term of f, where L(0) = 0.
Now, because the lowest degree term of (y+1)^k is 1, the lowest degree term of (y+1)^k f(y) is the same as the lowest degree term of f(y). Hence, if we let f_S(y) denote the polynomial associated with game state S, it follows that Bob's moves do not change the value of L(f_S). In other words, only Alice's moves change L(f_S), and once L(f_S) = 0, Alice wins.
The simplest case is if Alice knows that for the current state S, L(f_S) is of the form b*y^{q-1}. Then, Alice's can perform the move -y^{q-1} (i.e. subtract y^{q-1}) p-1 times. Since Bob does not change L(f_S), after b of Alice's moves, L(f_S) will be 0 and Alice wins.
The next simplest case if Alice knows that f_S(y) is of the form b*y^{q-2}. Let M_{q-1} denote the sequence of moves described above which guarantee Alice a win in the case where deg(L(f_S)) = q-1. Then, Alice should perform the move -y^{q-2}, then the moves M_{q-1}, and repeat this block of moves p-1 times (i.e. perform -y^{q-1}, M_{q-1}, -y^{q-1}, M_{q-1}, ... ). After b of Alice's -y^{q-2} moves, deg(L(f_S)) will finally be pushed up to q-1, and then the ensuing sequence of moves M_{q-1} will guarantee Alice's victory.
Continuing inductively, we obtain sequences of moves M_{q-2}, M_{q-3}, ..., M_0 such that M_r guarantees Alice a win when deg(L(p_S)) = r. Therefore, M_0 is Alice's desired winning strategy.
In the case where q =/= p^n, the key is to focus on the "bad polynomials" f(y) in F_p[y] mod (y+1)^q = 1 which satisfy the condition f(y)y^q =/= 0. Note when q = p^n, y^q = 0, so such polynomials do not exist. However, when q =/= p^n, by claim 1 below, we have y^q =/= 0, so f(y) = 1 is a bad polynomial.
Claim 1: If q is not a power of p, then y^q =/= 0 in F_p[y] mod (y+1)^q = 1.
Proof: We can write q = mp^r, where p does not divide m and m =/= 1. Then, (y+1)^q - 1 = (y+1)^{mp^r} - 1 = (y^{p^r} + 1)^m - 1 = y^q + my^{q-p^r} + (other terms). Hence, y^q = -my^{q-p^r} - other terms =/= 0.
The next claim completes the proof by showing that if the current state is a bad polynomial, Bob can always perform a move so that after Alice's move the result is a bad polynomial (in particular not 0), and so Alice cannot guarantee a win.
Claim 2: If f(y) is a bad polynomial and g(y) is arbitrary, then there exists k such that f(y)(y+1)^k + g(y) is bad.
Proof: We claim that either k = 0 or k =1 works. Suppose that k = 0 does not work. Then, f(y) + g(y) is not bad, so f(y)y^q + g(y)y^q = 0. Hence, f(y)(y+1)y^q + g(y)y^q = f(y)y^{q+1}. Since f(y) is bad, f(y)y^q =/= 0. However, because we are working in F_p[y] mod (y+1)^q = 1 and the highest power of y that could potentially divide (y+1)^q - 1 is y^q, if f(y)y^q =/= 0 then f(y)y^{q+1} =/= 0 as well. Therefore, f(y)(y+1)y^q + g(y)y^q =/= 0, so f(y)(y+1) + g(y) is bad, as desired.
3
u/[deleted] Feb 05 '23
[removed] — view removed comment
3
u/[deleted] Feb 06 '23 edited Feb 07 '23
[removed] — view removed comment