Identifier
Identifier
Values
[] generating graphics... => 0
[1] generating graphics... => 0
[2] generating graphics... => 0
[1,1] generating graphics... => 0
[3] generating graphics... => 1
[2,1] generating graphics... => 0
[1,1,1] generating graphics... => 0
[4] generating graphics... => 2
[3,1] generating graphics... => 1
[2,2] generating graphics... => 0
[2,1,1] generating graphics... => 0
[1,1,1,1] generating graphics... => 0
[5] generating graphics... => 0
[4,1] generating graphics... => 2
[3,2] generating graphics... => 1
[3,1,1] generating graphics... => 1
[2,2,1] generating graphics... => 0
[2,1,1,1] generating graphics... => 0
[1,1,1,1,1] generating graphics... => 0
[6] generating graphics... => 1
[5,1] generating graphics... => 0
[4,2] generating graphics... => 2
[4,1,1] generating graphics... => 2
[3,3] generating graphics... => 0
[3,2,1] generating graphics... => 1
[3,1,1,1] generating graphics... => 1
[2,2,2] generating graphics... => 0
[2,2,1,1] generating graphics... => 0
[2,1,1,1,1] generating graphics... => 0
[1,1,1,1,1,1] generating graphics... => 0
[7] generating graphics... => 2
[6,1] generating graphics... => 1
[5,2] generating graphics... => 0
[5,1,1] generating graphics... => 0
[4,3] generating graphics... => 3
[4,2,1] generating graphics... => 2
[4,1,1,1] generating graphics... => 2
[3,3,1] generating graphics... => 0
[3,2,2] generating graphics... => 1
[3,2,1,1] generating graphics... => 1
[3,1,1,1,1] generating graphics... => 1
[2,2,2,1] generating graphics... => 0
[2,2,1,1,1] generating graphics... => 0
[2,1,1,1,1,1] generating graphics... => 0
[1,1,1,1,1,1,1] generating graphics... => 0
[8] generating graphics... => 3
[7,1] generating graphics... => 2
[6,2] generating graphics... => 1
[6,1,1] generating graphics... => 1
[5,3] generating graphics... => 1
[5,2,1] generating graphics... => 0
[5,1,1,1] generating graphics... => 0
[4,4] generating graphics... => 0
[4,3,1] generating graphics... => 3
[4,2,2] generating graphics... => 2
[4,2,1,1] generating graphics... => 2
[4,1,1,1,1] generating graphics... => 2
[3,3,2] generating graphics... => 0
[3,3,1,1] generating graphics... => 0
[3,2,2,1] generating graphics... => 1
[3,2,1,1,1] generating graphics... => 1
[3,1,1,1,1,1] generating graphics... => 1
[2,2,2,2] generating graphics... => 0
[2,2,2,1,1] generating graphics... => 0
[2,2,1,1,1,1] generating graphics... => 0
[2,1,1,1,1,1,1] generating graphics... => 0
[1,1,1,1,1,1,1,1] generating graphics... => 0
[9] generating graphics... => 1
[8,1] generating graphics... => 3
[7,2] generating graphics... => 2
[7,1,1] generating graphics... => 2
[6,3] generating graphics... => 0
[6,2,1] generating graphics... => 1
[6,1,1,1] generating graphics... => 1
[5,4] generating graphics... => 2
[5,3,1] generating graphics... => 1
[5,2,2] generating graphics... => 0
[5,2,1,1] generating graphics... => 0
[5,1,1,1,1] generating graphics... => 0
[4,4,1] generating graphics... => 0
[4,3,2] generating graphics... => 3
[4,3,1,1] generating graphics... => 3
[4,2,2,1] generating graphics... => 2
[4,2,1,1,1] generating graphics... => 2
[4,1,1,1,1,1] generating graphics... => 2
[3,3,3] generating graphics... => 1
[3,3,2,1] generating graphics... => 0
[3,3,1,1,1] generating graphics... => 0
[3,2,2,2] generating graphics... => 1
[3,2,2,1,1] generating graphics... => 1
[3,2,1,1,1,1] generating graphics... => 1
[3,1,1,1,1,1,1] generating graphics... => 1
[2,2,2,2,1] generating graphics... => 0
[2,2,2,1,1,1] generating graphics... => 0
[2,2,1,1,1,1,1] generating graphics... => 0
[2,1,1,1,1,1,1,1] generating graphics... => 0
[1,1,1,1,1,1,1,1,1] generating graphics... => 0
[10] generating graphics... => 2
[9,1] generating graphics... => 1
[8,2] generating graphics... => 3
[8,1,1] generating graphics... => 3
[7,3] generating graphics... => 3
[7,2,1] generating graphics... => 2
[7,1,1,1] generating graphics... => 2
[6,4] generating graphics... => 3
[6,3,1] generating graphics... => 0
[6,2,2] generating graphics... => 1
[6,2,1,1] generating graphics... => 1
[6,1,1,1,1] generating graphics... => 1
[5,5] generating graphics... => 0
[5,4,1] generating graphics... => 2
[5,3,2] generating graphics... => 1
[5,3,1,1] generating graphics... => 1
[5,2,2,1] generating graphics... => 0
[5,2,1,1,1] generating graphics... => 0
[5,1,1,1,1,1] generating graphics... => 0
[4,4,2] generating graphics... => 0
[4,4,1,1] generating graphics... => 0
[4,3,3] generating graphics... => 2
[4,3,2,1] generating graphics... => 3
[4,3,1,1,1] generating graphics... => 3
[4,2,2,2] generating graphics... => 2
[4,2,2,1,1] generating graphics... => 2
[4,2,1,1,1,1] generating graphics... => 2
[4,1,1,1,1,1,1] generating graphics... => 2
[3,3,3,1] generating graphics... => 1
[3,3,2,2] generating graphics... => 0
[3,3,2,1,1] generating graphics... => 0
[3,3,1,1,1,1] generating graphics... => 0
[3,2,2,2,1] generating graphics... => 1
[3,2,2,1,1,1] generating graphics... => 1
[3,2,1,1,1,1,1] generating graphics... => 1
[3,1,1,1,1,1,1,1] generating graphics... => 1
[2,2,2,2,2] generating graphics... => 0
[2,2,2,2,1,1] generating graphics... => 0
[2,2,2,1,1,1,1] generating graphics... => 0
[2,2,1,1,1,1,1,1] generating graphics... => 0
[2,1,1,1,1,1,1,1,1] generating graphics... => 0
[1,1,1,1,1,1,1,1,1,1] generating graphics... => 0
[11] generating graphics... => 3
[10,1] generating graphics... => 2
[9,2] generating graphics... => 1
[9,1,1] generating graphics... => 1
[8,3] generating graphics... => 2
[8,2,1] generating graphics... => 3
[8,1,1,1] generating graphics... => 3
[7,4] generating graphics... => 0
[7,3,1] generating graphics... => 3
[7,2,2] generating graphics... => 2
[7,2,1,1] generating graphics... => 2
[7,1,1,1,1] generating graphics... => 2
[6,5] generating graphics... => 1
[6,4,1] generating graphics... => 3
[6,3,2] generating graphics... => 0
[6,3,1,1] generating graphics... => 0
[6,2,2,1] generating graphics... => 1
[6,2,1,1,1] generating graphics... => 1
[6,1,1,1,1,1] generating graphics... => 1
[5,5,1] generating graphics... => 0
[5,4,2] generating graphics... => 2
[5,4,1,1] generating graphics... => 2
[5,3,3] generating graphics... => 0
[5,3,2,1] generating graphics... => 1
[5,3,1,1,1] generating graphics... => 1
[5,2,2,2] generating graphics... => 0
[5,2,2,1,1] generating graphics... => 0
[5,2,1,1,1,1] generating graphics... => 0
[5,1,1,1,1,1,1] generating graphics... => 0
[4,4,3] generating graphics... => 1
[4,4,2,1] generating graphics... => 0
[4,4,1,1,1] generating graphics... => 0
[4,3,3,1] generating graphics... => 2
[4,3,2,2] generating graphics... => 3
[4,3,2,1,1] generating graphics... => 3
[4,3,1,1,1,1] generating graphics... => 3
[4,2,2,2,1] generating graphics... => 2
[4,2,2,1,1,1] generating graphics... => 2
[4,2,1,1,1,1,1] generating graphics... => 2
[4,1,1,1,1,1,1,1] generating graphics... => 2
[3,3,3,2] generating graphics... => 1
[3,3,3,1,1] generating graphics... => 1
[3,3,2,2,1] generating graphics... => 0
[3,3,2,1,1,1] generating graphics... => 0
[3,3,1,1,1,1,1] generating graphics... => 0
[3,2,2,2,2] generating graphics... => 1
[3,2,2,2,1,1] generating graphics... => 1
[3,2,2,1,1,1,1] generating graphics... => 1
[3,2,1,1,1,1,1,1] generating graphics... => 1
[3,1,1,1,1,1,1,1,1] generating graphics... => 1
[2,2,2,2,2,1] generating graphics... => 0
[2,2,2,2,1,1,1] generating graphics... => 0
[2,2,2,1,1,1,1,1] generating graphics... => 0
[2,2,1,1,1,1,1,1,1] generating graphics... => 0
[2,1,1,1,1,1,1,1,1,1] generating graphics... => 0
[1,1,1,1,1,1,1,1,1,1,1] generating graphics... => 0
[12] generating graphics... => 4
[11,1] generating graphics... => 3
[10,2] generating graphics... => 2
[10,1,1] generating graphics... => 2
[9,3] generating graphics... => 0
[9,2,1] generating graphics... => 1
[9,1,1,1] generating graphics... => 1
[8,4] generating graphics... => 1
[8,3,1] generating graphics... => 2
[8,2,2] generating graphics... => 3
[8,2,1,1] generating graphics... => 3
[8,1,1,1,1] generating graphics... => 3
[7,5] generating graphics... => 2
[7,4,1] generating graphics... => 0
[7,3,2] generating graphics... => 3
[7,3,1,1] generating graphics... => 3
[7,2,2,1] generating graphics... => 2
[7,2,1,1,1] generating graphics... => 2
[7,1,1,1,1,1] generating graphics... => 2
[6,6] generating graphics... => 0
[6,5,1] generating graphics... => 1
[6,4,2] generating graphics... => 3
[6,4,1,1] generating graphics... => 3
[6,3,3] generating graphics... => 1
[6,3,2,1] generating graphics... => 0
[6,3,1,1,1] generating graphics... => 0
[6,2,2,2] generating graphics... => 1
[6,2,2,1,1] generating graphics... => 1
[6,2,1,1,1,1] generating graphics... => 1
[6,1,1,1,1,1,1] generating graphics... => 1
[5,5,2] generating graphics... => 0
[5,5,1,1] generating graphics... => 0
[5,4,3] generating graphics... => 3
[5,4,2,1] generating graphics... => 2
[5,4,1,1,1] generating graphics... => 2
[5,3,3,1] generating graphics... => 0
[5,3,2,2] generating graphics... => 1
[5,3,2,1,1] generating graphics... => 1
[5,3,1,1,1,1] generating graphics... => 1
[5,2,2,2,1] generating graphics... => 0
[5,2,2,1,1,1] generating graphics... => 0
[5,2,1,1,1,1,1] generating graphics... => 0
[5,1,1,1,1,1,1,1] generating graphics... => 0
[4,4,4] generating graphics... => 2
[4,4,3,1] generating graphics... => 1
[4,4,2,2] generating graphics... => 0
[4,4,2,1,1] generating graphics... => 0
[4,4,1,1,1,1] generating graphics... => 0
[4,3,3,2] generating graphics... => 2
[4,3,3,1,1] generating graphics... => 2
[4,3,2,2,1] generating graphics... => 3
[4,3,2,1,1,1] generating graphics... => 3
[4,3,1,1,1,1,1] generating graphics... => 3
[4,2,2,2,2] generating graphics... => 2
[4,2,2,2,1,1] generating graphics... => 2
[4,2,2,1,1,1,1] generating graphics... => 2
[4,2,1,1,1,1,1,1] generating graphics... => 2
[4,1,1,1,1,1,1,1,1] generating graphics... => 2
[3,3,3,3] generating graphics... => 0
[3,3,3,2,1] generating graphics... => 1
[3,3,3,1,1,1] generating graphics... => 1
[3,3,2,2,2] generating graphics... => 0
[3,3,2,2,1,1] generating graphics... => 0
[3,3,2,1,1,1,1] generating graphics... => 0
[3,3,1,1,1,1,1,1] generating graphics... => 0
[3,2,2,2,2,1] generating graphics... => 1
[3,2,2,2,1,1,1] generating graphics... => 1
[3,2,2,1,1,1,1,1] generating graphics... => 1
[3,2,1,1,1,1,1,1,1] generating graphics... => 1
[3,1,1,1,1,1,1,1,1,1] generating graphics... => 1
[2,2,2,2,2,2] generating graphics... => 0
[2,2,2,2,2,1,1] generating graphics... => 0
[2,2,2,2,1,1,1,1] generating graphics... => 0
[2,2,2,1,1,1,1,1,1] generating graphics... => 0
[2,2,1,1,1,1,1,1,1,1] generating graphics... => 0
[2,1,1,1,1,1,1,1,1,1,1] generating graphics... => 0
[1,1,1,1,1,1,1,1,1,1,1,1] generating graphics... => 0
[5,4,3,1] generating graphics... => 3
[5,4,2,2] generating graphics... => 2
[5,4,2,1,1] generating graphics... => 2
[5,3,3,2] generating graphics... => 0
[5,3,3,1,1] generating graphics... => 0
[5,3,2,2,1] generating graphics... => 1
[4,4,3,2] generating graphics... => 1
[4,4,3,1,1] generating graphics... => 1
[4,4,2,2,1] generating graphics... => 0
[4,3,3,2,1] generating graphics... => 2
[5,4,3,2] generating graphics... => 3
[5,4,3,1,1] generating graphics... => 3
[5,4,2,2,1] generating graphics... => 2
[5,3,3,2,1] generating graphics... => 0
[4,4,3,2,1] generating graphics... => 1
[5,4,3,2,1] generating graphics... => 3
click to show generating function       
Description
The Grundy value for the game 'Couples are forever' on an integer partition.
Two players alternately choose a part of the partition greater than two, and split it into two parts. The player facing a partition with all parts at most two looses.
References
[1] Caines, I., Gates, C., Guy, R. K., Nowakowski, R. J. Unsolved Problems: Periods in Taking and Splitting Games MathSciNet:1543453
Code
@cached_function
def statistic(la):
    """Return the Grundy value of the partition for the game 'couples are
    forever'.
    """
    def children(la):
        for i in range(len(la)):
            p = la[i]
            if p > 2:
                mu = la[:i] + la[i+1:]
                for k in range(1, (p+2)//2):
                    yield Partition(sorted(mu + [p-k, k], reverse=True))

    l = [statistic(mu) for mu in children(la)]
    i = 0
    while i in l:
        i += 1
    
    return i
Created
Apr 06, 2017 at 23:39 by Martin Rubey
Updated
Dec 31, 2017 at 14:08 by Martin Rubey