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.

A376258 Decimal expansion of the probability where a change occurs in the optimal strategy for a coin game where you have to set aside at least one coin every round.

Original entry on oeis.org

5, 4, 9, 5, 0, 2, 1, 7, 7, 7, 6, 4, 2, 0, 1, 5, 4, 3, 1, 4, 4, 4, 5, 6, 5, 4, 6, 8, 7, 6, 3, 8, 4, 9, 4, 6, 5, 2, 1, 3, 7, 1, 8, 6, 5, 0, 2, 9, 0, 0, 1, 7, 2, 3, 6, 7, 2, 5, 1, 6, 8, 2, 6, 1, 3, 7, 5, 2, 0, 3, 0, 6, 5, 1, 9, 7, 7, 0, 7, 7, 1, 0, 7, 2, 4, 0, 2, 4, 8, 3, 8, 0, 1, 4, 2, 9, 3, 6, 5, 9
Offset: 0

Views

Author

Wouter van Doorn, Sep 17 2024

Keywords

Comments

You play the following game: you start out with n coins that all have probability p to land heads. You toss all of them and you then need to set aside at least one of them, which will not be tossed again. Now you repeat the process with the remaining coins. This continues (for at most n rounds) until all coins have been set aside. Your goal is to maximize the total number of heads you end up with. As it turns out, there exists a constant p_0 ~ 0.5495021777642 such that for p_0 < p < 1 it is (for large enough n) optimal to set aside exactly one coin every round, unless all coins landed heads. On the other hand, in the case that all but one of the coins show heads, then for p smaller than or equal to p_0 it is optimal (regardless of the value of n) to set aside all n-1 heads and toss the remaining coin again.

Examples

			0.54950217776420154314445654687638494652137186502900172367251682613752030651977...
		

Programs

  • PARI
    \p 125
    q = 0.5; r = 0.5; m = 2;
    {for(a = 1, 120,
    for(k = 0, 10,
    p = q + k/10^m;
    L = 10*m;
    v = vector(L);
    v[1] = p;
    v[2] = -p^3 + 3*p;
    n = 2;
    while(v[n] < v[1] + (n-1) && n < L, n=n+1;
    v[n] = v[n-1] + 1 + p^n*(n-1-v[n-1]) + n*p^(n-1)*(1-p)*max(0, n-2+p-v[n-1]) - (1-p)^n);
    if(n==L, r = p));
    q = r;
    m = m + 1)}
    print(p);