Specify the subtraction set (see examples below): | |||
n value to compute: | Make Table | ||
Sprague-Grundy Value |
To specify the (finite) subtraction set S = {1, 2, 3} use the following: S = [1,2,3] |
To specify the (infinite) subtraction set S = {1, 2, 4, 8, ...} use the following: var j=0; while(Math.pow(2,j)<=n) { S[j] = Math.pow(2,j); j++; } |
To specify the (infinite) subtraction set S = {1, 4, 9, 16, ...} use the following: var j=1; while(j*j<=n) { S[j-1] = j*j; j++; } |