The Magnus–Derek game revisited

The Magnus–Derek game revisited

Information Processing Letters 109 (2008) 38–40 Contents lists available at ScienceDirect Information Processing Letters www.elsevier.com/locate/ipl...

125KB Sizes 5 Downloads 118 Views

Information Processing Letters 109 (2008) 38–40

Contents lists available at ScienceDirect

Information Processing Letters www.elsevier.com/locate/ipl

The Magnus–Derek game revisited ✩ Cor A.J. Hurkens, Rudi A. Pendavingh, Gerhard J. Woeginger ∗ Department of Mathematics and Computer Science, TU Eindhoven, P.O. Box 513, 5600 MB Eindhoven, The Netherlands

a r t i c l e

i n f o

a b s t r a c t

Article history: Received 21 March 2008 Received in revised form 29 July 2008 Available online 23 August 2008 Communicated by K. Iwama

We provide a new adaptive strategy for the maximizer in the Magnus–Derek game on the n-cycle. We show that this new strategy succeeds within O (n log n) rounds, and thus improves on a predecessor result that uses a quadratic number of rounds. © 2008 Elsevier B.V. All rights reserved.

Keywords: Two-person game Analysis of algorithms Discrete mathematics

1. Introduction

Nedev and Muthukrishnan [3] introduce a combinatorial two-person game that they call the Magnus–Derek game. For a positive integer n, the game MD(n) is played on the set Zn = {0, 1, . . . , n − 1} of congruence classes modulo n. The two players are called Magnus (from magnitude, the maximizer) and Derek (from direction, the minimizer). In the starting position, there is a token positioned on the congruence class t = 0. A round consists of Magnus calling a magnitude m with 0  m  n/2, followed by Derek calling a direction + or −. The token is then moved from its current congruence class t to the new class t + m or t − m according to Derek’s choice of direction. The token leaves a trail of mud; whenever it visits a new congruence class, this class becomes dirty and stays dirty for the rest of the game. The goal of Magnus is to maximize the number of dirty congruence classes. The goal of Derek is to minimize the number of dirty congruence classes.

✩ This research has been supported by the Netherlands Organisation for Scientific Research, grant 639.033.403, and by BSIK grant 03018 (BRICKS: Basic Research in Informatics for Creating the Knowledge Society). Corresponding author. E-mail addresses: [email protected] (C.A.J. Hurkens), [email protected] (R.A. Pendavingh), [email protected] (G.J. Woeginger).

*

0020-0190/$ – see front matter doi:10.1016/j.ipl.2008.08.007

©

2008 Elsevier B.V. All rights reserved.

Definition 1.1. (See Nedev and Muthukrishnan [3].) The function f ∗ : N → N is defined as follows. If n is a power of two, then f ∗ (n) = n. If n is not a power of two, then f ∗ (n) = ( p − 1)n/ p, where p is the smallest odd prime factor of n. Theorem 1.2. (See Nedev and Muthukrishnan [3].) For every integer n  1, Magnus can eventually enforce at least f ∗ (n) dirty congruence classes in MD(n), whereas Derek can permanently prevent him from soiling more than f ∗ (n) classes. The second half of Theorem 1.2 is actually straightforward: If n has an odd prime factor p, then Derek can never be forced to move the token into a class that is congruent 1 modulo p. Nedev and Muthukrishnan [3] also investigate the smallest number r (n) of rounds needed by Magnus to soil at least f ∗ (n) congruence classes.

• If n = 2k is a power of two, then r (n) = n − 1. • If n = p 2k is the product of a prime and a power of two, then r (n) is O ( p 2 + n). • If n is a prime, then r (n) is O (n2 ). • If n is neither a power of two nor a prime, then r (n) is O (n2 / p ), where p is the smallest odd prime factor of n. The bound r (n) = n − 1 for the case n = 2k is of course best possible. The following theorem improves the bounds

C.A.J. Hurkens et al. / Information Processing Letters 109 (2008) 38–40

in all remaining cases, and is the main contribution of the current note. (Note that all logarithms in this paper are logarithms to base 2.) Theorem 1.3. Let n  3 be a positive integer that is not a power of two, and let u denote the greatest odd divisor of n. Then there exists a strategy for Magnus that soils at least f ∗ (n) congruence classes within at most f ∗ (u ) log(u − 1) + n − u rounds. The bound in Theorem 1.3 is weakest in the cases where n is prime. Then u = n and f ∗ (u ) = n − 1, and the bound becomes (n − 1) log(n − 1). Our proofs are very simple, considerably shorter than the proofs in [3], and yield a stronger statement. Section 2 formulates some mathematical tools on subsets of congruence classes that are closed under certain operations. Section 3 wraps everything up and proves Theorem 1.3.

2. Mathematical tools Throughout this section, n will denote an odd integer. The midpoint of two elements x, y ∈ Zn is (x + y )/2. For a set S ⊆ Zn , we denote Mid( S ) = {(x + y )/2 | x, y ∈ S }, Half( S ) = {x/2 | x ∈ S }, and Sum( S ) = {x + y | x, y ∈ S }. Note that the operations Half and Sum commute, and that Mid( S ) = Half(Sum( S )) = Sum(Half( S )). Lemma 2.1. Let n  3 be an odd integer, and let p be the smallest prime factor of n. Let A ⊆ Zn be a set of congruence classes with A = Mid( A ). If | A | > n/ p, then A = Zn . Proof. Let x1 < x2 < · · · < xk be an enumeration of the elements of A; we define xk+ = x for all . Consecutive numbers x and x+1 in this enumeration always have opposing parities, since otherwise their midpoint would lie strictly between them. This implies that x and x+2 always have the same parity, and hence their midpoint coincides with x+1 . This in turn implies that the differences x+1 − x are all the same, and that the numbers x occur at regular intervals. Hence k divides n. Since n/ p is the largest non-trivial divisor of n, we see that | A | > n/ p implies A = Zn . 2 Lemma 2.2. Let n  3 be an odd integer, and let B 0 ⊆ Zn be a set of congruence classes such that 0 ∈ B 0 . For k  0 define B k+1 = Sum( B k ). Then B k+1 = B k for all k with 2k  n − 1. Proof. For 2k  n − 1, the set B k actually equals the subgroup of Zn generated by B 0 . The lemma itself is an immediate consequence of a well-known theorem by Kneser; see, for instance, Satz 2 in Kneser [1] or Theorem 1.5 in Mann [2]. 2 Lemma 2.3. Let n  3 be an odd integer, and let C 0 ⊆ Zn . For k  0 define C k+1 = Mid(C k ). Then C k+1 = C k holds for all k with 2k  n − 1. Proof. First, after performing an appropriate circular shift we may assume 0 ∈ C 0 . Secondly, we observe that C k = Halfk (Sumk (C 0 )). Finally, we apply Lemma 2.2. 2

39

3. Proof of the main theorem In this section we will prove Theorem 1.3. The proof is split into two lemmas. Lemma 3.1 settles the case of odd integers n, and Lemma 3.2 extends the result to even integers. Lemma 3.1. For any odd integer n  3, Magnus has a strategy for the game MD(n) that soils f ∗ (n) congruence classes within at most f ∗ (n) log(n − 1) rounds. Proof. We show that whenever there are fewer than f ∗ (n) dirty classes, Magnus can soil some currently clean class within log(n − 1) rounds. Let p be the smallest prime factor of n, and let C 0 denote the set of currently clean classes. Since there are fewer than f ∗ (n) dirty classes, |C 0 | > n/ p. For k  0 define C k+1 = Mid(C k ), and let   1 denote the smallest index with C  = C +1 = Mid(C  ). Now C 0 ⊆ C  implies |C  |  |C 0 | > n/ p, and Lemma 2.1 yields C  = Zn . Furthermore, Lemma 2.3 yields   log(n − 1). Magnus proceeds as follows: Since the current position t of the token is in C  = Zn , there exist two distinct classes x, y ∈ C −1 such that t = (x + y )/2. Then Magnus calls m = (x − y )/2. If Derek calls his direction, the token either moves to x or to y; in either case the token moves into set C −1 . In an analogous way, Magnus forces the token step by step into classes C k with smaller and smaller indices. After at most   log(n − 1) rounds, the token moves into C 0 and a new class becomes dirty. 2 Lemma 3.2. Assume that for every odd integer u  1, Magnus has a strategy for the game MD(u ) that soils f ∗ (u ) congruence classes within at most g (u ) rounds. Then for every integer n  1 with greatest odd divisor u, Magnus has a strategy for the game MD(n) that soils f ∗ (n) congruence classes within at most g (u ) + n − u rounds. Proof. The central idea is very simple: Consider a game MD(ab), and consider some fixed class c with 0  c  b. Then the a classes c +  b with 0    a − 1 form a scaled and translated version of the game MD(a) embedded in MD(ab). Hence, any strategy for MD(a) that soils a certain number of congruence classes in a certain number of rounds can be translated into a (scaled) strategy working on the classes c +  b that soils the same number of classes in the same number of rounds. Now let us prove the lemma. The case where n = 2k was fully settled in [3]. Magnus can soil all n congruence classes in n − 1 rounds: If n = 2, then Magnus calls m = 1, and wins in one round. If n = 2k with k  2, Magnus first applies his strategy for 2k−1 to soil all even classes; then Magnus calls m = 1 and forces the token into an odd class; finally Magnus applies his strategy for 2k−1 to soil the remaining odd classes. All in all, this needs only n − 1 rounds. If n is not a power of two, write n = 2k u. For 0  c  u, define S c = {c + u | 0    2k − 1}. Magnus plays MD(n) by emulating MD(u ). Every class c in MD(u ) corresponds to the set S c of 2k classes in MD(n). Whenever Magnus

40

C.A.J. Hurkens et al. / Information Processing Letters 109 (2008) 38–40

visits a set S c in MD(n) for the first time, he spends 2k − 1 rounds to run through all classes in S c ; this is done by applying a scaled version of the above strategy for game MD(2k ). Altogether, Magnus needs g (u ) + u (2k − 1) rounds. 2

soil f ∗ (7) = 6 classes within 15 rounds and that this is best possible. The corresponding sequence of moves is 1, 3, 1, 3, 1, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3.

4. Final remarks

We thank Hendrik W. Lenstra for pointing us to reference [2]. This improved most of the bounds from an earlier version of this note by a factor of 2.

The hardest (and most interesting) cases of MD(n) seem to be the cases where n is prime, for which Theorem 1.3 yields an upper bound of roughly n log n on the number of rounds. The obvious open question is: Can this bound be lowered even further to something like n log log n, or perhaps even to O (n)? Also the non-adaptive version of the game (where Magnus announces to Derek all his moves right at the beginning of the game) seems challenging. A computer search reveals that for n = 7, Magnus non-adaptively can

Acknowledgement

References [1] M. Kneser, Ein Satz über abelsche Gruppen mit Anwendungen auf die Geometrie der Zahlen, Mathematische Zeitschrift 61 (1955) 429–434. [2] H.B. Mann, Addition Theorems: The Addition Theorems of Group Theory and Number Theory, John Wiley & Sons, 1965. [3] Z. Nedev, S. Muthukrishnan, The Magnus–Derek game, Theoretical Computer Science 393 (2008) 124–132.