cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A366995 a(n) is the numerator of the expected end time of a game with three gamblers, one of which starts with capital n, the others with capital 1 each, conditional on the event that one of the two poor players wins.

Original entry on oeis.org

3, 39, 359, 2477, 119667, 1522705, 46419629, 6143100517, 5472109127035, 790136773603303, 278129286200597661, 16684426086791338103, 503067648850136040148699, 2626565018569118643191009, 10920130209346850287269887104735, 236686188450953790757840351941895
Offset: 1

Views

Author

Pontus von Brömssen, Oct 31 2023

Keywords

Comments

In each round of the game, 1 unit is transferred from one randomly chosen player to another. Players play until they are out of money, so when the first player is out the other two continue to play. The winner is the player who ends up with all n+2 units of money.

Crossrefs

Cf. A366566 (a(n)/A366996(n) rounded to nearest integer), A366996 (denominators).

Programs

  • Sage
    from itertools import permutations
    def T(n):
        nodes = [(i,j) for i in range(n+2) for j in range((n+2-i)//2+1)]
        m = len(nodes)
        Q0 = {x:{y:0 for y in nodes} for x in nodes}
        for x in nodes:
            c1 = x+(n+2-sum(x),)
            for i,j in permutations(range(3),int(2)):
                if c1[i] and c1[j]:
                    c2 = list(c1)
                    c2[i] -= 1
                    c2[j] += 1
                    y = (c2[0],min(c2[1:]))
                    if c2[0] != n+2:
                        Q0[x][y] += n+2-c2[0]
        Q0 = matrix(QQ,[list(R.values()) for R in Q0.values()])
        s = sum(Q0.columns())
        Q = identity_matrix(QQ,m-1)
        for i in range(1,m):
            for j in range(1,m):
                if s[i] != 0: Q[i-1,j-1] -= Q0[i,j]/s[i]
        return (Q**(-1)*ones_matrix(QQ,m-1))[-2,0]
    def A366995(n):
        return T(n).numerator()
    def A366996(n):
        return T(n).denominator()