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.
%I A365443 #55 Apr 02 2025 15:57:22 %S A365443 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 A365443 26925,1,1,6,36,216,1296,4651,24781,129936,667116,3327696,1,1,7,49, %U A365443 343,2401,16807,70993,450295,2825473,17492167,106442161,633074071,1,1,8,64 %N 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. %C A365443 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 A365443 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 A365443 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). %H A365443 Alois P. Heinz, <a href="/A365443/b365443.txt">Rows n = 0..100, flattened</a> %F A365443 T(n,s) = 1 for s = 0, %F A365443 (n+1)^(s-1) for 0 < s <= n, %F A365443 (n+1)^(s-1) - (n+1)^(s-n-2)*s*n^n for n < s <= 2n. %e A365443 Triangle begins: %e A365443 0 | 1 %e A365443 1 | 1 1 1 %e A365443 2 | 1 1 3 5 11 %e A365443 3 | 1 1 4 16 37 121 376 %e A365443 4 | 1 1 5 25 125 369 1589 6665 26925 %e A365443 5 | 1 1 6 36 216 1296 4651 24781 129936 667116 3327696 %p A365443 b:= proc(n, s) option remember; %p A365443 `if`(s=0, 1, add(b(n, s-j)/n, j=1..min(s, n))) %p A365443 end: %p A365443 T:= (n, s)-> numer(b(n, s)): %p A365443 seq(seq(T(n,s), s=0..2*n), n=0..7); # _Alois P. Heinz_, Apr 01 2025 %t A365443 A365443[n_, s_] := If[s == 0, 1, (n+1)^(s-1) - If[s > n, (n+1)^(s-n-2)*s*n^n, 0]]; %t A365443 Table[A365443[n, s], {n, 0, 6}, {s, 0, 2*n}] (* _Paolo Xausa_, Apr 02 2025 *) %o A365443 (Python) %o A365443 def Pn(n,s): # probability numerator of rolling s with an n-sided die %o A365443 if s==0: return 1 %o A365443 elif s>n: return int((n+1)**(s-n-2)*(n*(n+1)**n-n**n*s+(n+1)**n)) %o A365443 else: return (n+1)**(s-1) %o A365443 [Pn(n,s) for n in range(10) for s in range(2*n+1)] %Y A365443 Main diagonal gives A000272(n+1). %Y A365443 Cf. A366451. %K A365443 nonn,tabf,frac %O A365443 0,7 %A A365443 _Nicholas Stefan Georgescu_, Oct 23 2023