News for hackers. Stuff that matters.
Re:Counterintuitive problem: People in a room keep giving do... by daddyo on Monday July 10, 2017 @03:58AM (#14734119)
High school diploma solution:

There are increasingly more ways to distribute wealth unevenly, than evenly.

Reduce the problem to the simplest case of 3 persons: `a`, `b`, and `c`. Person `a` has decision to give to either `b` or `c`. Then use combinatorics:

    from itertools import product

    decisions_a = ['ab', 'ac']
    decisions_b = ['ba', 'bc'] 
    decisions_c = ['ca', 'cb']

    for combination in product(decisions_a, decisions_b, decisions_c):
        print combination

    >>> ('ab', 'ba', 'ca') # uneven
    >>> ('ab', 'ba', 'cb') # uneven
    >>> ('ab', 'bc', 'ca') # even
    >>> ('ab', 'bc', 'cb') # uneven
    >>> ('ac', 'ba', 'ca') # uneven
    >>> ('ac', 'ba', 'cb') # even
    >>> ('ac', 'bc', 'ca') # uneven
    >>> ('ac', 'bc', 'cb') # uneven

There are no comments on this comment yet.