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-1 of 1 results.

A365443 Triangle read by rows: T(n,s) is the numerator of the probability that the sum s occurs when repeated rolls of an n-sided die are summed for s = 0..2n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 3, 5, 11, 1, 1, 4, 16, 37, 121, 376, 1, 1, 5, 25, 125, 369, 1589, 6665, 26925, 1, 1, 6, 36, 216, 1296, 4651, 24781, 129936, 667116, 3327696, 1, 1, 7, 49, 343, 2401, 16807, 70993, 450295, 2825473, 17492167, 106442161, 633074071, 1, 1, 8, 64
Offset: 0

Views

Author

Keywords

Comments

The triangle is formed by considering the probability of occurrence of a zero-indexed sum, s, of repeated rolls of an n-sided die. The probability is obtained by considering that the sum s = 0 appears with probability 1, and then for every s > 0, the sum s has a probability of appearing that is 1/n times the sum of the probability of appearing of each of the previous n values of s. The denominator of this probability is n^s, and the numerator is given in the rows of the triangle below.
For example, consider repeated rolls of an n=4-sided die. Looking at the corresponding portion of the sequence (i.e., 1, 1, 3, 5, 11), the probability that s = 0 occurs is 1/1, the probability that s = 1 occurs is 1/(n^s) = 1/4, the probability that s = 2 occurs is 5/(n^s) = 5/16, as there is a 1/4 chance that it is rolled from the start plus the 1/16 chance that it occurs when two consecutive 1's are rolled, and so on. Hence the probability for all s <= n numbers that can be rolled is (n+1)^(s-1)/n^s, with a global maximum at s = n.
However, for s > n, where there is no longer the chance that the sum occurs in a single roll, the fraction drops precipitously. It then resumes rising until s = floor((n+1)^(n+1)/n^n - n) (see A366451) which is the s having the maximum probability for s > n. Therefore this maximum will always occur at s <= 2n for all nontrivial dice (i.e., dice with n > 1 sides). Hence the rows of this triangle have been terminated at 2n since that guarantees the maximum, but a row could in principle be extended in perpetuity, wherein the fraction would stabilize about the value 2/(n+1).

Examples

			Triangle begins:
  0  |  1
  1  |  1  1  1
  2  |  1  1  3   5   11
  3  |  1  1  4  16   37   121    376
  4  |  1  1  5  25  125   369   1589   6665   26925
  5  |  1  1  6  36  216  1296   4651  24781  129936   667116   3327696
		

Crossrefs

Main diagonal gives A000272(n+1).
Cf. A366451.

Programs

  • Maple
    b:= proc(n, s) option remember;
          `if`(s=0, 1, add(b(n, s-j)/n, j=1..min(s, n)))
        end:
    T:= (n, s)-> numer(b(n, s)):
    seq(seq(T(n,s), s=0..2*n), n=0..7);  # Alois P. Heinz, Apr 01 2025
  • Mathematica
    A365443[n_, s_] := If[s == 0, 1, (n+1)^(s-1) - If[s > n, (n+1)^(s-n-2)*s*n^n, 0]];
    Table[A365443[n, s], {n, 0, 6}, {s, 0, 2*n}] (* Paolo Xausa, Apr 02 2025 *)
  • Python
    def Pn(n,s): # probability numerator of rolling s with an n-sided die
        if s==0: return 1
        elif s>n: return int((n+1)**(s-n-2)*(n*(n+1)**n-n**n*s+(n+1)**n))
        else: return (n+1)**(s-1)
    [Pn(n,s) for n in range(10) for s in range(2*n+1)]

Formula

T(n,s) = 1 for s = 0,
(n+1)^(s-1) for 0 < s <= n,
(n+1)^(s-1) - (n+1)^(s-n-2)*s*n^n for n < s <= 2n.
Showing 1-1 of 1 results.