Comment

Comment by jordigh

This is an irreducible Markov chain (i.e. it's possible to go from any state to any other with positive probability in a certain number of steps) on a finite state space (because money never enters or leaves the system). This means that every state is recurrent, i.e. will happen if you wait long enough.

This is the relevant theorem:

https://math.stackexchange.com/questions/543051/markov-chain...

This means you should eventually see each person hoard all of the money in turn. Try it with 5 people and 5 dollars each. Then the system only has 29 choose 25 = 23751 states[1], which should give your computer enough time to hit them all.

Edit: Here, Python "proof"

    from random import randint

    numpeople = 5
    initmoney = 5

    ledger = [initmoney]*numpeople

    while True:

        recipients = []
        for i in range(numpeople):
            if ledger[i] == 0:
                recipient = None
            else:
                recipient = randint(0, numpeople-2)
                if recipient >= i:
                    recipient += 1
            recipients.append(recipient)

        for i, recipient in enumerate(recipients):
            if recipient is not None:
                ledger[i] -= 1
                ledger[recipient] += 1

        if max(ledger) == initmoney*numpeople - 1:
            print ledger

----

[1] https://en.wikipedia.org/wiki/Stars_and_bars_(combinatorics)...

parent jordigh 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton