Next Article in Journal
Ray Solomonoff (1926-2009)
Previous Article in Journal
Segment LLL Reduction of Lattice Bases Using Modular Arithmetic
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An O(n)-Round Strategy for the Magnus-Derek Game

International University VNU-HCM, Block 6, Linh Trung Ward, Thu Duc District, HCM City, Vietnam
Algorithms 2010, 3(3), 244-254; https://doi.org/10.3390/a3030244
Submission received: 8 June 2010 / Revised: 6 July 2010 / Accepted: 8 July 2010 / Published: 15 July 2010
(This article belongs to the Special Issue Algorithmic Game Theory)

Abstract

:
We analyze further the Magnus-Derek game, a two-player game played on a round table with n positions. The players jointly control the movement of a token. One player, Magnus, aims to maximize the number of positions visited while minimizing the number of rounds. The other player, Derek, attempts to minimize the number of visited positions. We present a new strategy for Magnus that succeeds in visiting the maximal number of positions in 3 ( n 1 ) rounds, which is the optimal number of rounds up to a constant factor.

1. Introduction

In this paper we analyze further the Magnus-Derek game, a two-player game introduced in [1]. The game is played on a circular table with n positions labeled consecutively from 0 to n 1 in a clockwise direction. A single token is initially placed at position 0. A round consists of the first player, Magnus (from magnitude) choosing an integer magnitude 0 < n 2 , followed by the second player, Derek (from direction) choosing whether the token will move clockwise or counter-clockwise. The token is then moved positions in the chosen direction. Magnus’s primary goal is to maximize the total number of distinct positions visited by the token over the course of the game (and secondarily, to minimize the number of rounds), while Derek main aim is to minimize the number of positions visited. These goals are natural since for all n not exact power of 2, Derek has a strategy to prevent the token from visiting some of the positions [1]. For brevity, we will skip from now the word distinct in all expressions of type “maximize the total number of distinct positions visited.”
In our analysis we will use Z n = { 0 , 1 , 2 , , n 1 } to represent the table of size n. Let K Z n denote the position of the token at the beginning of a round. The round then consists of Magnus choosing a magnitude 0 < n 2 , Derek choosing a direction + or − (where the positive direction corresponds to “clockwise”), and the token moving to ( K ± ) mod n .
In [1,2], the following function on the set of positive integers was used. Let n > 0 be an integer. Then
f * ( n ) = n if n = 2 k for some k > 0 , p 1 p · n otherwise, where p is the smallest odd prime factor of n .
In [1] (and subsequently with a shorter proof in [2]), the following theorem was obtained.
Theorem 1. 
  • Derek has a strategy to prevent the token from visiting more than f * ( n ) positions no matter how long the game is played.
  • Magnus has a strategy to ensure the token visits at least f * ( n ) positions.
One of the strategies previously given for Magnus by Nedev and Muthukrishnan requires O ( n 2 ) rounds [1]. A recent paper by Hurkens, Pendavingh, and Woeginger gives an O ( n log ( n ) ) -round strategy [3]. In this paper, we will show that Magnus can visit f * ( n ) positions in 3 ( n 1 ) rounds, the optimal number of rounds up to a constant factor. Although some of the basic ideas in the two papers are the same, we wrote our paper well before the paper of Hurkens, Pendavingh, and Woeginger was published [4], and our results were found independently from theirs .
Our strategy for Magnus requires that he know the factorization of n. To our knowledge, this is the first game in which the ability to factor conveys an advantage to a player. In another variant of the game called the Vector game [5], the players’ goals are reversed: Magnus wants to minimize the set of occupied positions, while Derek aims to maximize the number of positions visited. The ability to factor can also give a crucial advantage to a player here. Moreover the analysis of this second variant of the game is also not completely done yet; it created several new open problems (see [5,6]).
As mentioned in [1], the sequence { f * ( n ) } n = 1 = ( 1 , 2 , 2 , 4 , 4 , 4 , 6 , 8 , 6 , 8 , ) diverges non-monotonically and non-linearly to . This sequence has not previously appeared in the Encyclopedia of Integer Sequences [7].

2. An O ( n ) -Round Strategy for Magnus

We will give an algorithmic strategy, recursive on the factorization of the table size n, for Magnus to visit f * ( n ) positions in O ( n ) rounds. We begin with the cases where n is a power of two or is prime.

2.1. When n is a power of two

An optimal strategy was given in [1] for when the table size is a power of two. We quote only the result here:
Theorem 2. 
(from [1]) If n = 2 k for some integer k, then f * ( n ) = n , and Magnus can visit all positions in n 1 rounds, regardless of Derek’s strategy.

2.2. When n is prime

Let n > 2 be prime. Since n is prime, by Theorem 1 we have that f * ( n ) = n 1 n n = n 1 . We will prove that there is a strategy for Magnus to visit at least n 1 positions in at most 2 ( n 1 ) rounds.
Our key idea (which coincides with the idea in [3]) behind Magnus’ strategy is as follows. Let K denote the current position of the token, and let A denote the set of unvisited positions. Notice that if K is equidistant (with distance d) from two different positions in A , then Magnus can choose magnitude d and, regardless of Derek’s choice, the token will move to one of those positions. We will use this fact by constructing a nested sequence of sets A M ( A ) M ( 2 ) ( A ) M ( log 2 ( n ) ) ( A ) = Z n with the property that for i > 0 , each position in M ( i ) ( A ) M ( i 1 ) ( A ) is equidistant from a pair of positions in M ( i 1 ) ( A ) . Then, if K M ( i ) ( A ) M ( i 1 ) ( A ) for some i, Magnus can move the token to a position in M ( i 1 ) ( A ) in one round. Since K Z n = M ( log 2 ( n ) ) ( A ) , Magnus can always move the token to an unvisited position in at most log 2 ( n ) rounds. This idea may be applied repeatedly, with the set of unvisited positions A decreasing in size by one each time. We will show that in this manner n 1 positions can be visited.
We begin with some necessary standard notations and background from additive number theory. Let A and B be two subsets of Z n . Then the sumset of A and B is
A + B : = { e Z n : there exist a A , b B such that e a + b ( mod n ) }
and a q-dilate of A is
q * A : = { e Z n : there exists a A such that e q a ( mod n ) } .
We now define a map on the family of subsets of Z n .
Definition 1. Let A Z n , | A | 2 . The set of all middles between pairs of elements of A is defined by
M ( A ) : = { z Z n : t h e r e e x i s t x , y A s u c h t h a t 2 z x + y ( mod n ) } .
When n is odd, 2 1 Z n exists and then
M ( A ) = { 2 1 ( x + y ) mod n : x , y A } .
We will use the notation M ( i ) ( A ) to denote the recursive application to A of the map M, i times, and define M ( 0 ) ( A ) = A . For example, M ( 3 ) ( A ) = M ( M ( M ( A ) ) ) .
Thus A M ( A ) , and for each pair of points x , y A , all points equidistant from x and y are contained in M ( A ) . When n is odd, there is a unique midpoint equidistant from x and y.
Remark 1. If n is odd, and A is the arithmetic progression { a 0 + i δ : 0 i m 1 } Z n for some a 0 , δ , and m, then M ( A ) = { a 0 + i δ 2 1 : 0 i 2 m 2 } and is consequently easy to compute.
Bellow, we use the following well known Cauchy-Davenport Theorem [8,9].
Theorem 3. 
If p is a prime, and A , B are two non-empty subsets of Z p , then
| A + B | min { p , ( | A | + | B | 1 }
Lemma 1. 
Let n > 2 be prime and A Z n . Then for any positive integer i,
| M ( i ) ( A ) | min { n , 2 i ( | A | 1 ) + 1 } .
Proof. 
Since n is odd, M ( A ) = 2 1 * ( A + A ) and so | M ( A ) | = | A + A | . By Theorem 3, | M ( A ) | = | A + A | min ( n , 2 | A | 1 ) = min ( n , 2 ( | A | 1 ) + 1 ) . Thus the lemma holds for i = 1 .
Applying the above inequality recursively, we have that | M ( i ) ( A ) | min { n , a i } where a i is the i-th term of the recurrence relation
a m = 2 a m 1 1 , for m = 1 , , i ; a 0 = | A | .
By induction, it is easy to prove that for any positive integer i, a i = 2 i ( | A | 1 ) + 1 . This is trivially true for i = 1 . Assuming the inductive hypothesis for i 1 , it follows that
a i = 2 a i 1 1 = 2 ( 2 i 1 ( | A | 1 ) + 1 ) 1 = 2 i ( | A | 1 ) + 1 .
Lemma 2. 
Let n > 2 be prime, and A Z n , | A | 2 . Then A M ( A ) M ( 2 ) ( A ) M ( log 2 ( n ) ) ( A ) = Z n . Note that it is possible to have M ( i ) ( A ) = Z n for i < log 2 ( n ) .
Proof. 
The inclusions follow from the definition of the map M.
For | A | 2 , we have 2 log 2 ( n ) ( | A | 1 ) + 1 > n . Then by Lemma 1, | M ( log 2 ( n ) ) ( A ) | = n , and so M ( log 2 ( n ) ) ( A ) = Z n . ☐
Lemma 3. 
Let n > 2 be prime, and let A Z n , | A | 2 . Then if z M ( i ) ( A ) M ( i 1 ) ( A ) for some i > 0 , there exist two distinct positions x , y M ( i 1 ) ( A ) such that z is equidistant from x and y.
Proof. 
Since z M ( i ) ( A ) M ( i 1 ) ( A ) , by definition of the map M there exist positions x , y M ( i 1 ) ( A ) such that z = 2 1 ( x + y ) . Thus z is equidistant from x and y. Since z M ( i 1 ) ( A ) , x and y are distinct. ☐
Thus, given a set of unvisited positions A , we are able to construct a nested sequence of sets with the desired property. While | A | 2 , Lemmas 2 and 3 guarantee that Magnus can move the token to an unvisited position. By repeated use of this idea until | A | = 1 , Magnus can visit all but one position. It remains to show that this takes at most 2 ( n 1 ) rounds.
Remark 2. Notice that Derek controls which single position remains unvisited. We will use this fact when we give the strategy for composite table sizes in Section 2.3.
Theorem 4. 
Let the table size n > 2 be prime. Then Magnus can visit f * ( n ) = n 1 positions in at most 2 ( n 1 ) rounds.
Proof. 
Throughout this proof we will use A to denote the remaining set of unvisited positions, and K the current position of the token. At the beginning of the game, | A | = n 1 , since the token initially occupies a position. Let h = log 2 ( n ) .
In order to count the number of rounds required, we use the following idea. Let k be a non-negative integer. By equation (1) in Lemma 1, if | A | n 1 2 k + 1 , then | M ( k ) ( A ) | min { n , 2 k ( | A | 1 ) + 1 } = n. It follows that M ( k ) ( A ) = Z n , and so Magnus can move the token to an unvisited position in at most k rounds.
Initially, | A | = n 1 = n 1 2 0 n 1 2 1 + 1 , so M ( 1 ) ( A ) = Z n and only one round is required to move the token to an unvisited position. Magnus may continue to visit unvisited positions at the cost of one round per position until | A | < n 1 2 1 + 1 . Thus he visits n 1 2 0 n 1 2 1 positions in 1 × n 1 2 0 n 1 2 1 rounds.
Similarly, when n 1 2 1 + 1 > | A | n 1 2 2 + 1 , he may visit n 1 2 1 n 1 2 2 positions at the cost of at most two rounds per position, for a total of at most 2 × n 1 2 1 n 1 2 2 rounds.
Eventually, | A | = 1 = n 1 2 h + 1 < n 1 2 h + 1 + 1 , and he must stop. We thus have that the total number of rounds is at most
1 × n 1 2 0 n 1 2 1 + 2 × n 1 2 1 n 1 2 2 + + h × n 1 2 h 1 n 1 2 h + ( h + 1 ) × n 1 2 h n 1 2 h + 1 = n 1 2 0 + n 1 2 1 + + n 1 2 h ( h + 1 ) n 1 2 h + 1 (by telescoping) n 1 2 0 + 1 + n 1 2 1 + 1 + + n 1 2 h + 1 ( h + 1 ) (since n 1 2 h + 1 = 1 ) = ( n 1 ) ( 1 2 0 + 1 2 1 + 1 2 2 + + 1 2 h ) 2 ( n 1 ) .

2.3. When n is composite

Let n be composite, and let p be the smallest odd prime factor of n. Then by Theorem 1 we have f * ( n ) = p 1 p n . We will give a recursive strategy for Magnus, proving that he can visit at least f * ( n ) positions in at most 3 ( n 1 ) rounds. The better bound on the number of rounds is obtained using the recursive strategy from [1].
We present the strategy in two phases. In the first phase of the strategy, Magnus partitions the table into p congruence classes each of size n p , moves the token to p 1 of these classes using a strategy based on Section 2.2, and in each of these p 1 classes recursively applies this two-phase strategy to visit at least f * ( n p ) positions within the class. Thus at the end of the first phase, Magnus will have visited at least ( p 1 ) f * ( n p ) positions, and at most ( p 1 ) n p = f * ( n ) positions. If Magnus succeeds in visiting f * ( n ) positions then the second phase is not needed. Otherwise, he uses a second technique to visit some of the unvisited positions left over from the first phase, bringing the total number of visited positions up to f * ( n ) .

2.3.1. The first phase: Decomposition into classes, and recursive visitation

Lemma 4 (Decomposition). 
Let the table size be n = a b , where a and b are integers greater than 1. Suppose that on a table of size a (resp. b), Magnus has a strategy α (resp. β) to visit f * ( a ) (resp. f * ( b ) ) positions in r ( a ) (resp. r ( b ) ) rounds. Then on the table of size n, Magnus is able to visit f * ( a ) f * ( b ) positions in r ( b ) + r ( a ) f * ( b ) rounds.
Proof. 
We partition the table positions (i.e., the elements of Z n ) into the b congruence classes modulo b, each of size a:
[ i ] b = { i + j b : 0 j a 1 } for 0 i b 1
We first note that Magnus can restrict his play to positions in a particular class. Let K denote the current position of the token, and suppose that K [ i ] b for some 0 i b 1 . Magnus can then play as follows on an imaginary table of size a whose positions are the elements of [ i ] b . On each round, Magnus employs strategy α to calculate a magnitude as if the table size were a, but then chooses b as the actual magnitude to use. Then the new position of the token will be K ± b [ i ] b , and so the token will remain within the class.
Magnus’ overall strategy will be to repeatedly move the token to an unvisited class, and then, by restricting his play to positions within that class, use strategy α to visit f * ( a ) positions within that class in r ( a ) rounds.
Now suppose that K [ i ] b for some i, and notice that for any magnitude , ( K ± ) mod n [ i ± ( mod b ) ] b . Magnus can use this idea to play on an imaginary table of size b whose positions correspond to the b congruence classes. By employing strategy β on this imaginary table, Magnus will visit f * ( b ) different classes in r ( b ) rounds. Each time the token lands in an unvisited class, Magnus temporarily restricts his play to that class, and employs strategy α until he has visited f * ( a ) positions within that class. He then continues with strategy β until he reaches another unvisited class.
Since Magnus can visit f * ( b ) classes in r ( b ) rounds, and can visit f * ( a ) positions in r ( a ) rounds within each class, the total number of positions visited will be f * ( a ) f * ( b ) and the total number of rounds will be r ( b ) + r ( a ) f * ( b ) . ☐
Magnus applies the Decomposition Lemma (Lemma 4) by letting n = p m , where p is the smallest odd prime factor of n, and partitioning the table into p congruence classes modulo p, each of size n p . He then proceeds as in the proof of the lemma, letting strategy β be the technique for playing on a table of prime size from Section 2.2. Theorem 4 then guarantees that he will visit p 1 congruence classes. As he visits each class, he restricts his play to it and, depending on the size of the class, chooses one of the following strategies to be strategy α:
Case 1) 
If the size is a power of two, he uses the strategy from Section 2.1. Then by Theorem 2 he will visit all positions in the class.
Case 2) 
If the size is a prime, he uses the strategy from Section 2.2. Then by Theorem 4 he will visit all but one position in the class.
Case 3) 
Otherwise, if the size is composite, he uses the strategy being described here (Section 2.3), applied recursively.
We will use the terminology exploring a class to refer to the process of restricting play to a class and choosing an appropriate strategy α. We will also say that a class that has been visited in this fashion has been explored.
See phase 1 of algorithm 1, below, for a pseudo-code description of this strategy.
Recall that Magnus’ goal is to visit f * ( n ) = p 1 p n positions (in as few rounds as possible). Since only p 1 classes have been visited, Magnus will have visited f * ( n ) positions only if he visited all n p positions in each of the p 1 classes. But this is possible only when n = 2 k p for some integer k, since only in case 1 does Magnus visit every position in a class. So for most table sizes n, the first phase is insufficient for Magnus to visit f * ( n ) positions. We solve this issue by visiting in the second phase some of the leftover unvisited positions, either in the classes that Magnus has explored, or in the one class that was never visited.

2.3.2. The second phase: Visiting leftover unvisited positions

Here, Magnus’ strategy is the same as in Phase 2 from [1]. At the end of the first phase, there is one unvisited class, which we denote [ γ ] p , and p 1 explored classes, which we denote [ δ 1 ] p , , [ δ p 1 ] p . Inductively we assume that on a table of size n p Magnus can visit f * ( n p ) positions in at most 3 ( n p 1 ) rounds. (This will follow from the inductive hypothesis in our proof in Section 2.3.3.) It follows that at the end of the first phase at least f * ( n p ) positions have been visited in each of the explored classes. Without loss of generality we assume the worst case, in which exactly f * ( n p ) positions were visited. Let p be the second smallest odd prime factor of n. By Theorem 1, f * ( n p ) = p 1 p · n p . Then in each explored class, n p f * ( n p ) = n p p positions remain unvisited.
We consider two ways in which Magnus can bring the total number of visited positions up to f * ( n ) . If Magnus visits all n p p leftover positions in each of the explored classes, then he will have visited every position in p 1 classes for a total of f * ( n ) = ( p 1 ) n p positions. If instead he visits f * ( n p ) positions of [ γ ] p , then he will have visited all but n p p positions in every class, leaving n p n p unvisited positions in total. But this means that he has visited f * ( n ) positions.
Therefore Magnus’ goal will be to either move the token to the class [ γ ] p , at which point he can recursively explore that class, or to visit all unvisited positions in [ δ 1 ] p , , [ δ p 1 ] p .
Notice that since γ , δ 1 , , δ p 1 are the p distinct elements of p , we have that γ , 2 1 ( δ 1 + γ ) , , 2 1 ( δ p 1 + γ ) are also distinct in Z p . Therefore, up to re-ordering, we may write the explored classes as [ 2 1 ( δ 1 + γ ) ] p , , [ 2 1 ( δ p 1 + γ ) ] p . Let J [ δ i ] p be an unvisited position for some 1 i p 1 , and suppose for the moment that Magnus is able to move the token to a position K [ 2 1 ( δ i + γ ) ] p . Consider what happens when Magnus chooses the magnitude J K . If Derek chooses the positive (clockwise) direction, then the token moves to K + ( J K ) = J , and Magnus visits the unvisited position. Otherwise, the token moves to K ( J K ) [ γ ] p .
Using the above idea, Magnus has the following strategy. As in the first phase, he uses the technique from Section 2.2 to play on an imaginary table of size p, where each position on this table corresponds to a class. Then by Theorem 4 he will visit p 1 classes. If at any time he visits the class [ γ ] p , he recursively explores it and is done. Otherwise, he will visit each of the p 1 explored classes, [ 2 1 ( δ 1 + γ ) ] p , , [ 2 1 ( δ p 1 + γ ) ] p . Each time he visits a class [ 2 1 ( δ i + γ ) ] p he has the opportunity to visit an unvisited position in the class [ δ i ] p .
By repeating this process n p p times (for the n p p unvisited positions in each explored class) he will eventually visit all unvisited positions in every explored class.
We give Magnus’ strategy in pseudo-code in algorithm 1, below. It remains to prove that this strategy visits at least f * ( n ) positions in at most 3 ( n 1 ) rounds.
Algorithm 1 Recursive algorithm for exploring a table of size n.
Require
p is the smallest prime factor of n.
Require
The table is partitioned into p congruence classes modulo p, { [ i ] p : 0 i p 1 } , each of size n p .-
1:
//Phase 1: Visit p 1 congruence classes, and recursively explore each one.
2:
//In the below loop, Magnus plays on an imaginary table of size p where each position corresponds to a class, as in the Decomposition Lemma (Lemma 4). The strategy from Section 2.2 is used as strategy β in the Lemma.
3:
while fewer than p 1 classes have been visited do
4:
  Move to an unvisited class [ i ] p . //May require multiple rounds.
5:
  //Now choose strategy α.
6:
  if | [ i ] p | = 2 k for some integer k then
7:
      Use the strategy from Section 2.1 to visit all 2 k positions of [ i ] p in 2 k 1 rounds.
8:
  else if | [ i ] p | = q , where q is prime then
9:
      Use the strategy from Section 2.2 to visit q 1 positions of [ i ] p in at most 2 ( q 1 ) rounds.
10:
  else
11:
      Recursively apply this algorithm to the class [ i ] p .
12:
  end if
13:
end while
14:
//Phase 2: Visit remaining unvisited positions.
15:
//We denote the unvisited class [ γ ] p , and the explored classes [ δ 1 ] p , , [ δ p 1 ] p .
16:
while there are unvisited positions in [ δ 1 ] p , , [ δ p 1 ] p do
17:
  Mark the classes [ δ 1 ] p , , [ δ p 1 ] p as not yet visited in this iteration.
18:
  //In the below inner loop, Magnus again plays on an imaginary table of size p where each position corresponds to a class, using the strategy from Section 2.2.
19:
  while more than one class remains marked do
20:
      Move to a marked class [ 2 1 ( δ i + γ ) ] p for some 1 i p 1 . //May require multiple rounds.
21:
      Choose the magnitude so that the token will move to either [ γ ] p or an unvisited position in [ δ i ] p . //Token moves in one round.
22:
      if the token is in [ γ ] p then
23:
            Recursively apply this algorithm to the class [ γ ] p , and stop.
24:
      else
25:
            Unmark the class [ 2 1 ( δ i + γ ) ] p .
26:
      end if
27:
  end while
28:
end while

2.3.3. Proof of the strategy

We will prove that Magnus’ strategy allows him to visit at least f * ( n ) positions in at most 3 ( n 1 ) rounds. First notice that Derek controls whether the token ever reaches [ γ ] p . For in Section 2.2, Derek controls which position remains unvisited (Remark 2), and so here controls which class remains unvisited (on the imaginary table whose positions are classes). Furthermore, each time the token is in a class [ 2 1 ( δ i + γ ) ] p for some i, Derek controls whether the token moves to [ γ ] p .
We will thus make the assumption that Magnus visits [ γ ] p if and only if he does not visit any of the leftover unvisited positions in the explored classes. This assumption is justified by Derek’s primary goal to minimize the number of positions visited by Magnus. For if Magnus is allowed to visit both [ γ ] p and at least one leftover unvisited position in the explored classes, the total number of visited positions will be greater than p f * ( n / p ) and since f * ( n / p ) ( p 1 ) ( n / p ) p , the total number of visited positions will be greater than f * ( n ) .
Theorem 5. 
Let n = p m where p is the smallest odd prime factor of n. If Derek does not allow for more than f * ( n ) visited positions and therefore is consistent in his choices (as stated above), then there exists a strategy for Magnus to visit at least f * ( n ) = p 1 p n positions in at most 3 ( n 1 ) rounds.
Proof. 
Let s denote the number of odd prime factors of n. We will prove by induction on s that Magnus visits at least f * ( n ) positions in at most 3 ( n 1 ) rounds.
Base case 1) 
n = 2 k , k > 0 . Then by Theorem 2 Magnus visits f * ( n ) = 2 k positions in n 1 3 ( n 1 ) rounds.
Base case 2) 
n = p , p prime. Then by Theorem 4 Magnus visits f * ( n ) = p 1 positions in at most 2 ( p 1 ) 3 ( n 1 ) rounds.
Base case 3) 
n = 2 k p , k > 0 , p prime. Then in the first phase Magnus visits all 2 k positions in each of p 1 classes. He requires at most 2 ( p 1 ) rounds to visit the classes, and 2 k 1 to explore each class, for a total of at most 2 ( p 1 ) + ( p 1 ) ( 2 k 1 ) 3 ( n 1 ) rounds. No second phase is needed.
We now let s > 1 and assume the following inductive hypothesis: If n has s 1 odd prime factors then Magnus can visit at least f * ( n ) positions in at most 3 ( n 1 ) rounds.
Let n = 2 k p 1 p 2 p s , where p 1 , p 2 , , p s are prime and listed in increasing order. Then there are p 1 classes, each of size n p 1 . Magnus’ goal is to visit at least f * ( n ) = p 1 1 p 1 n positions, or equivalently, to leave at most n p 1 positions unvisited.
In the first phase of the algorithm, Magnus visits p 1 1 classes and recursively applies the algorithm to explore within each class. Then by the inductive hypothesis, he leaves at most n p 1 f * ( n p 1 ) = n p 1 p 2 unvisited positions in each explored class. Without loss of generality, we assume the worst case of n p 1 p 2 unvisited positions. Furthermore, [ γ ] p 1 has not been visited, so a total of ( p 1 1 ) n p 1 p 2 + n p 1 positions remain unvisited.
Magnus requires at most 2 ( p 1 1 ) rounds to visit the p 1 1 classes (Theorem 4 as applied in the first phase). Furthermore, by the inductive hypothesis he requires at most 3 ( n p 1 1 ) rounds to recursively explore each class. So by lemma 4, at the end of the first phase, at most 2 ( p 1 1 ) + 3 ( p 1 1 ) ( n p 1 1 ) rounds have occurred.
For the second phase we consider two cases.
Case A) 
Magnus never visits [ γ ] p 1 . Then in order to achieve his goal Magnus must visit all of the leftover unvisited positions in the p 1 1 explored classes. This requires that he repeatedly visit the explored classes n p 1 p 2 times (using the strategy from Section 2.2). Each time, he takes at most 3 ( p 1 1 ) rounds, 2 ( p 1 1 ) from Theorem 4, and p 1 1 from the one round to move from [ 2 1 ( δ i + γ ) ] p 1 to [ δ i ] p 1 for each 1 i p 1 1 . Thus a total of at most 3 n p 1 p 2 ( p 1 1 ) rounds are required for the second phase.
Case B) 
Magnus visits [ γ ] p 1 , but no leftover unvisited positions in the explored classes. By the inductive hypothesis, Magnus leaves at most n p 1 p 2 positions unvisited in [ γ ] p 1 . Since this is also true of the explored classes, a total of at most p 1 n p 1 p 2 n p 1 positions remain unvisited, and Magnus achieves his goal.
We now count how many rounds this requires. At the end of the first phase, at most one round is required to move the token to [ γ ] p 1 , for if the token is not already in [ γ ] p 1 then it is in [ 2 1 ( δ i + γ ) ] p 1 for some i. By the inductive hypothesis Magnus requires at most 3 ( n p 1 1 ) rounds to explore [ γ ] p 1 . Thus a total of at most 1 + 3 ( n p 1 1 ) rounds are required for the second phase.
In both cases, Magnus visits at least f * ( n ) positions, and a simple calculation shows that he achieves this goal in at most 3 ( n 1 ) rounds. ☐

2.3.4. Efficiency of the strategy

In order for Magnus to calculate magnitudes in the above algorithm, he must know at each round the smallest integer k such that M ( k ) ( A ) = Z n (see the proof of Theorem 4 in Section 2.2). In general, the only way we know to determine this is to consecutively compute A , M ( A ) , M ( 2 ) ( A ) , until we reach Z n . Furthermore, Lemma 3 requires that as we calculate these sets we record for each position z M ( i ) ( A ) M ( i 1 ) ( A ) ( 1 i j ) a pair of positions x , y M ( i 1 ) ( A ) such that z is equidistant from x and y. With a naive algorithm, this is computationally time consuming. Given a set S of size m, computing M ( S ) requires calculations of 2 1 ( x + y ) ( mod m ) for each x , y S , and so is O ( m 2 ) .

3. Open Problems

We propose several open problems for future study.
  • What is the most efficient way for Magnus to compute magnitudes in this strategy?
  • Can we prove a tighter upper bound on the number of rounds required by Magnus? We conjecture that there is a strategy for Magnus to visit f * ( n ) positions in at most n + c rounds, where c is a small constant.
  • Can we find a nontrivial lower bound for the number of rounds Magnus needs to visit f * ( n ) positions?
  • Which strategy of Derek’s would maximize the number of rounds Magnus requires to visit f * ( n ) positions?

Acknowledgments

I am very grateful to Noam Sturmwind for editing assistance.

References

  1. Nedev, Z.; Muthukrishnan, S. The Magnus-Derek Game. Theoret. Comput. Sci. 2008, 393, 124–132. [Google Scholar] [CrossRef]
  2. Nedev, Z. Universal Sets and the Vector Game. INTEGERS: Electr. J. Combinat. Number Theory 2008, 8, #A45. [Google Scholar]
  3. Hurkens, C.A.J.; Pendavingh, R.A.; Woeginger, G.J. The Magnus–Derek game revisited. Inf. Proc. Lett. 2008, 109, 38–40. [Google Scholar] [CrossRef]
  4. Sturmwind, N.; University of Victoria, Victoria, BC, Canada. Personal communication, 23 June 2008.
  5. Nedev, Z.; Quas, A. Balanced Sets and The Vector Game. Int. J. Number Theory 2008, 4, 339–347. [Google Scholar] [CrossRef]
  6. Nedev, Z. An algorithm for finding a nearly minimal balanced set in F p . Math. Comput. 2009, 78, 2259–2267. [Google Scholar] [CrossRef]
  7. Sloane, N. On line Encyclopedia of Sequences. Availible online: http://www.research.att.com/ njas/sequences/ (accessed on 8 July 2010).
  8. Cauchy, A.L. Recherches sur les nombres. J. Ec. Polytech. 1813, 9, 99–116. [Google Scholar]
  9. Davenport, H. On the addition of residue classes. J. Lond. Math. Soc. 1935, 10, 30–32. [Google Scholar] [CrossRef]

Share and Cite

MDPI and ACS Style

Nedev, Z. An O(n)-Round Strategy for the Magnus-Derek Game. Algorithms 2010, 3, 244-254. https://doi.org/10.3390/a3030244

AMA Style

Nedev Z. An O(n)-Round Strategy for the Magnus-Derek Game. Algorithms. 2010; 3(3):244-254. https://doi.org/10.3390/a3030244

Chicago/Turabian Style

Nedev, Zhivko. 2010. "An O(n)-Round Strategy for the Magnus-Derek Game" Algorithms 3, no. 3: 244-254. https://doi.org/10.3390/a3030244

Article Metrics

Back to TopTop