%I #42 Mar 27 2024 08:58:39
%S 1,1,1,1,1,1,3,5,11,1,1,4,16,37,121,376,1,1,5,25,125,369,1589,6665,
%T 26925,1,1,6,36,216,1296,4651,24781,129936,667116,3327696,1,1,7,49,
%U 343,2401,16807,70993,450295,2825473,17492167,106442161,633074071,1,1,8,64
%N 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.
%C 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.
%C 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.
%C 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).
%F T(n,s) = 1 for s = 0,
%F (n+1)^(s-1) for 0 < s <= n,
%F (n+1)^(s-1) - (n+1)^(s-n-2)*s*n^n for n < s <= 2n.
%e n
%e 0 | 1
%e 1 | 1 1 1
%e 2 | 1 1 3 5 11
%e 3 | 1 1 4 16 37 121 376
%e 4 | 1 1 5 25 125 369 1589 6665 26925
%e 5 | 1 1 6 36 216 1296 4651 24781 129936 667116 3327696
%o (Python)
%o def Pn(n,s): # probability numerator of rolling s with an n-sided die
%o if s==0: return 1
%o elif s>n: return int((n+1)**(s-n-2)*(n*(n+1)**n-n**n*s+(n+1)**n))
%o else: return (n+1)**(s-1)
%o [Pn(n,s) for n in range(10) for s in range(2*n+1)]
%Y Cf. A366451.
%K nonn,tabf,frac
%O 0,7
%A _Nicholas Stefan Georgescu_, Oct 23 2023