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.

Showing 1-3 of 3 results.

A366451 The sum s > n which has the greatest probability of occurring when summing rolls of an n-sided die.

Original entry on oeis.org

4, 6, 8, 9, 11, 13, 15, 16, 18, 20, 21, 23, 25, 27, 28, 30, 32, 34, 35, 37, 39, 40, 42, 44, 46, 47, 49, 51, 52, 54, 56, 58, 59, 61, 63, 64, 66, 68, 70, 71, 73, 75, 76, 78, 80, 82, 83, 85, 87, 88, 90, 92, 94, 95, 97, 99, 101, 102, 104, 106, 107, 109, 111, 113
Offset: 2

Views

Author

Keywords

Comments

A player chooses a target t > n and rolls a fair n-sided die repeatedly, keeping a running total of the numbers rolled. The player wins if t occurs in the sequence of running totals. a(n) is the choice of t that maximizes the probability of winning
A fair die with sides numbered 1 through n is assumed.
For given n, sum s occurs by adding one die role to a sum s-n .. s-1; so the probability p(s) of s occurring is p(s) = Sum_{i=1..n} p(s-i)*(1/n), i.e., the mean of the preceding n probabilities, and starting from p(0) = 1 for s=0 always occurring and p(s) = 0 for s < 0 never occurring.
It is immediately apparent upon plotting the probabilities from sum s = n+1 onwards that the highest probability is achieved at s = a(n).
It can be shown that, given the equation of n < s <= 2n, the maximum near a(n) is the only zero of the first derivative, and the second derivative is always negative, therefore any following probability must necessarily be less the maximum of the previous n probabilities, and therefore less than p(a(n)). Therefore any subsequent terms must then be less than p(a(n)). Because this is appending a rolling average of the previous n terms the probabilities dampen in their oscillations about a value of 2/(n+1).

Examples

			For n=20, the probability of occurrence p(s) of sum s > n begins at p(21) = 0.08266... and rises to p(35) = 0.09767... before decreasing to p(36) = 0.09760... and never reaches p(35) again, so a(20) = 35 is the sum s with greatest probability of occurrence.
           s     p(s)
          --  ----------
          21  0.08266...
          ...
          34  0.09751...
  a(20) = 35  0.09767... <--- maximum probability
          36  0.09760...
          ...
          42  0.09350...
		

Crossrefs

Programs

  • Mathematica
    A366451[n_] := Floor[(n+1)^(n+1)/n^n] - n; Array[A366451, 100, 2] (* Paolo Xausa, Oct 12 2024 *)
  • Python
    from fractions import Fraction
    a = lambda n: int(Fraction((n+1)*(n+1)**n-n**(n+1),n**n))

Formula

For n < s < 2n, the probability of sum s occurring is p(s) = ((n+1)^(s-1) - s*n^n*(n+1)^(s-n-2))/n^s, which means that, from the difference between s and s-1, the sequence value is given by:
a(n) = floor(((n+1)*(n+1)^n - n^(n+1))/n^n).
a(n) = A060644(n) - n.
An empirical observation is that a(n) is well approximated by (e-1)*(n+1/2).
From Javier Múgica, May 01 2025: (Start)
Taylor expansion of the maximum of p(s) gives a(n) ~ (e-1)*(n+1/2) - (e-2)/(24n).
The maximum for s > 2n is attained at s ~ (e-sqrt(-e^2+2e+2))*n, approx. 2.5*n. In general, the position of the maximum for s > kn is given by an algebraic equation in s and e of degree k in each of them. (End)

A382606 Natural numbers ordered by the probability (highest to lowest) to occur in the sum of repeated rolls of a fair 6-sided die.

Original entry on oeis.org

6, 5, 11, 12, 10, 16, 17, 15, 21, 22, 27, 23, 26, 28, 32, 33, 38, 37, 39, 43, 44, 49, 48, 50, 54, 55, 60, 59, 53, 65, 61, 66, 64, 70, 71, 76, 75, 77, 81, 82, 87, 72, 86, 88, 92, 93, 98, 97, 103, 99, 104, 102, 108, 109, 114, 115, 113, 110, 119, 120, 125, 124, 126
Offset: 1

Views

Author

Sergio Pimentel, Mar 31 2025

Keywords

Comments

The asymptotic probability for large n is 2/7 since the average roll of a die is 7/2.
Only terms with probability > 2/7 occur. - Michael S. Branicky, Apr 01 2025
Of any six consecutive integers, at least one is present and gives a maximum in the sequence (i.e., all terms preceding it are smaller). - Javier Múgica, May 01 2025

Examples

			The probability of achieving a '6' in n>=6 rolls is 1/6 + 5/36 + 10/216 + 10/1296 + 5/7776 + 1/46656 which is about 36.02%.
The probability of achieving a '1' is just 1/6 (about 16.67%). 6 is the highest of all, so a(1) = 6.
		

Crossrefs

Complement of A382607. Cf. A365443.

Programs

  • Python
    from fractions import Fraction
    from math import factorial, prod
    from itertools import count, islice
    from sympy.utilities.iterables import partitions
    def prob(n): return sum(factorial(N:=sum(p.values()))//prod(factorial(v) for v in p.values())*Fraction(1, 6**N) for p in partitions(n, k=6))
    def agen(): # generator of terms
        n, vdict = 1, dict()
        for k in count(1):
            vdict[prob(k)] = k
            if k%6 == 0:
                s = [vdict[v] for v in sorted(vdict, reverse=True) if v > Fraction(2, 7)]
                yield from (s[i-1] for i in range(n, len(s)-1))
                n = len(s) - 1
    print(list(islice(agen(), 20))) # Michael S. Branicky, Apr 01 2025

A382607 Natural numbers ordered by the probability (lowest to highest) to occur in the sum of repeated rolls of a fair 6-sided die.

Original entry on oeis.org

1, 2, 3, 7, 4, 8, 13, 9, 14, 19, 18, 24, 25, 20, 30, 29, 31, 35, 36, 41, 40, 34, 46, 42, 47, 45, 51, 52, 57, 56, 58, 62, 63, 68, 67, 69, 73, 74, 79, 78, 84, 80, 85, 83, 89, 90, 95, 94, 96, 100, 101, 91, 106, 105, 107, 111, 112, 117, 116, 122, 118, 123, 128, 127
Offset: 1

Views

Author

Sergio Pimentel, Mar 31 2025

Keywords

Comments

The asymptotic probability for large n is 2/7 since the average roll of a die is 7/2.
Only terms with probability < 2/7 occur. - Michael S. Branicky, Apr 01 2025
Of any six consecutive integers, at least one is present and gives a maximum in the sequence (i.e., all terms preceding it are smaller). - Javier Múgica, May 01 2025

Examples

			The probability of achieving a '6' in n>=6 rolls is 1/6 + 5/36 + 10/216 + 10/1296 + 5/7776 + 1/46656 which is about 36.02%.
The probability of achieving a '1' is just 1/6 (about 16.67%). 1 is the lowest of all, so a(1)=1.
		

Crossrefs

Complement of A382606. Cf. A365443.

Programs

  • Python
    from fractions import Fraction
    from math import factorial, prod
    from itertools import count, islice
    from sympy.utilities.iterables import partitions
    def prob(n): return sum(factorial(N:=sum(p.values()))//prod(factorial(v) for v in p.values())*Fraction(1, 6**N) for p in partitions(n, k=6))
    def agen(): # generator of terms
        n, vdict = 1, dict()
        for k in count(1):
            vdict[prob(k)] = k
            if k%6 == 0:
                s = [vdict[v] for v in sorted(vdict) if v < Fraction(2, 7)]
                yield from (s[i-1] for i in range(n, len(s)-1))
                n = len(s) - 1
    print(list(islice(agen(), 20))) # Michael S. Branicky, Apr 01 2025
Showing 1-3 of 3 results.