Restricted Nim and fractal sequences
-
Maximum Nim & Minimum Nim

The Game of Nim

Sprague-Grundy functions

Definition

One considers a 1-graph without loops whose set of vertices is X.
A function of Grundy, when it exists, assigns to every vertex x of the graph a nonnegative integer g(x) which is the smallest not in g(Y) where Y is the set of the successors of X (P. Mr. Grundy 1939).
The function g(x) is often noted mex(x) (MEX: Minimal EXcludant)

Example

The game of Nim where the two players remove in turn, 1, 2 or three stones of the heap. The winner is that which withdraws the last stone.
The associated graph have the set X = {0, 1, 2, ..., 200} of vertices and each vertex x have x-1, x-2 et x-3 for successors (when they exists).
g(0) = 0 because 0 have no successor.
g(1) = 1, g(2) = 2, g(3)=3,
g(4) = 0 because g(1)=1, g(2)=2, g(3)=3 and therefore 0 is the smallest non-negative integer not in {1, 2, 3}.
g(n) = n%4 is the remainder of the Euclidean division of N by 4. We obtain the sequence ID Number: A010873 of N.J.A. Sloane

Properties

Not always a graph admit a function of Grundy.
A symmetrical graph admits a function of Grundy. Idem for a transitive graph and a graph without circuit odd length. A graph without circuit admits a unique function of Grundy G and for any vertex x, g(x) is lower or equal to the length of the longest path starting at x.
The set N of vertices x such as g(x) = 0 is a kernel of the graph. Indeed, it is easy to show
x in N does not have a successor y in N.
if X is not in N, then it has a successor in N.

Divide-and-conquer (important for the games of Nim with several heaps): if a graph G is a Cartesian sum of several G_i graphs admitting a function of Grundy g_i, then G admits for function of Grundy the digital sum (the XOR noted ~) G = g_1 ~ g_2 ~ g_3..

Maximum and Minimum Nim

Games concerned

In the example describes higher, the withdrawal carried out by a player lies between 1 and 3. One will generalize this play by defining a minimum min(n) and a maximum max(n) stones removed depending only on number N of stones of the heap. According to the type of game, remove between min(n) and N stones for minimum Nim and 1 to max(n) stones for maximum Nim. Note: The game of Fibonacci-Nim is not included in this category because the interval depends on the preceding play and not on number N of stones.

Properties

Some properties are shown in the references. One will be able to seek to discover them on the examples suggested (to click on the button [ Examples ]).
One can also make new examples.
The calculated sequences are the g(i) for i varying from 0 to n.

Examples

Maximum n/2
Minimum n/2
Maximum periodic

Application

You can modify below the values of the two tables this.min[i] or this.max[i].
The code is write in Javascript and you can use the mathematical functions of the Javascript language)
Some of these sequences are referred on the site of N.J.A. Sloane. Pure traditional Nim is: click HERE.


Restricted Nim - Grundy
n =   function of Grundy G
  lines of terms
  difference n- g(n)
(g, f, g-f-1) when f = max[i] grows




         



Related pages

Jeu de Wythoff Fonction de Grundy - Périodicité
Games of Nim
Bookmarks for the games of Nim

References, documents, links

Fractal Sequences and Restricted Nim   Lionel Levine University of California Berkeley "... We introduce a new variant of Nim, Restricted Nim, which restricts the number of stones a player may re- move from a heap in terms of the size of the heap. Certain classes of Restricted Nim are found to produce sequences of Grundy numbers with a self-similar fractal structure..."
Divide-and-conquer   The political proverb divide ut imperes is now a fundamental strategy in computer science; Philippe Dumas INRIA Rocquencourt
The On-Line Encyclopedia of Integer Sequences   
Nim - Wikipedia
Elwyn Berlekamp   
Combinatorial Game Theory   David Eppstein
Combinatorial Game Suite   is an open-source program to aid research in combinatorial game theory.

















Pour un premier contact, [utilisez ce formulaire] ou utilisez l'adresse de messagerie qui y figure. Merci d'indiquer la page précise du site "http//jm.davalan.org/...", cela m'aidera beaucoup. Ne joignez aucun document à votre message.
Jeux-et-Mathématiques n'est pas un site commercial. Aucun des liens placés sur ce site n'est rémunéré, ni non plus aucune des informations données.
Important : Si votre question a un quelconque rapport avec un travail personnel (Devoir TIPE Master...) , vous devez absolument me le préciser dès votre premier message et m'indiquer très précisément les limites des informations demandées. Vous devez aussi avertir la personne qui dirige éventuellement votre travail ou le corrige de cette communication et lui montrer les documents fournis.

J'essaie de répondre aux questions posées, mais ne lis pas les documents mathématiques amateurs, pas plus que je ne donne mon avis sur les démonstrations des conjectures de Collatz ou autres. Je ne lis pas les documents word, je ne corrige pas les programmes informatiques et depuis des années je n'utilise plus de tableur.

© (Copyright) Jean-Paul Davalan 2002-2014