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 A355659 #56 Mar 31 2024 15:35:53 %S A355659 0,1,-1,2,1,-3,3,5,-1,-7,4,11,7,-7,-15,5,19,24,4,-21,-31,6,29,53,38, %T A355659 -12,-51,-63,7,41,97,111,41,-57,-113,-127,8,55,159,243,187,5,-163, %U A355659 -239,-255,9,71,242,458,500,248,-130,-394,-493,-511,10,89,349,784,1084,874,202,-488,-878,-1003,-1023 %N A355659 Martingale win/loss triangle, read by rows: T(n,k) = total number of dollars won (or lost) using the martingale method on all possible n trials that have exactly k losses and n-k wins, for 0 <= k <= n. %C A355659 The martingale betting method is as follows: bet $1. If win, bet $1 on next trial. If lose, double your bet on next trial. Repeat for a total of n times. %C A355659 We can use row n of the triangle to find the total expected value for n trials, if we assume that the probability of each win is p. The expected value is Sum_{k=0..n} T(n,k)*p^k*(1-p)^(n-k). In a "fair" game where p = 1/2, this equals 0, as expected. %F A355659 T(n,k) = T(n-1,k) + T(n-1,k-1) + binomial(n-1,k) for 0 < k < n. %F A355659 Sum_{k=0..n} T(n,k) = 0 (the sum of each row equals 0). %F A355659 The following six formulas describe the three leftmost columns and the three rightmost diagonals of the triangle drawn below. %F A355659 T(n,0) = n (this is the scenario with n trials, 0 losses; since the martingale method has us bet 1 after each win, we end up with total earnings equal to n). %F A355659 T(n,1) = n^2 - n - 1 (this scenario is when there are n trials with just 1 loss; calculations show that this equals n^2 - n - 1 = A165900(n)). %F A355659 T(n,2) = (n^3 - 3n^2 - 2)/2. %F A355659 T(n,n) = 1 - 2^n = A000225(n). %F A355659 T(n,n-1)= 1 + 2*n - 2^n = A070313(n). %F A355659 T(n,n-2) = (3*n^2 - n)/2 + 1 - 2^n. %F A355659 G.f.: x*(1-y)*(1-x*y) / ((1 - x*(1+y))^2 * (1-2*x*y)). - _Kevin Ryde_, Aug 30 2022 %e A355659 Triangle T(n,k) begins: %e A355659 n\k| 0 1 2 3 4 5 6 7 8 9 %e A355659 ---+------------------------------------------- %e A355659 0| 0 %e A355659 1| 1 -1 %e A355659 2| 2 1 -3 %e A355659 3| 3 5 -1 -7 %e A355659 4| 4 11 7 -7 -15 %e A355659 5| 5 19 24 4 -21 -31 %e A355659 6| 6 29 53 38 -12 -51 -63 %e A355659 7| 7 41 97 111 41 -57 -113 -127 %e A355659 8| 8 55 159 243 187 5 -163 -239 -255 %e A355659 9| 9 71 242 458 500 248 -130 -394 -493 -511 %e A355659 Examples from triangle: %e A355659 T(4,3) = -7: In this example, we consider all possibilities with 4 trials that result in 3 losses and one win. There are binomial(4,3) = 4 different combinations to consider (lllw, llwl, lwll, and wlll), which have net earnings of +1, 0, -2, -6 respectively when using the martingale method, giving a total of -7. %e A355659 T(6,2) = 53: In this example, we have 6 trials and we consider the results with 2 losses and 4 wins. There are binomial(6,2) = 15 such combinations to consider (wwwwll, wwwlwl, wwwllw, wwlwwl, wwlwlw, wwllww, wlwwwl, wlwwlw, wlwlww, wllwww, lwwwwl, lwwwlw, lwwlww, lwlwww, llwwww), and summing over all 15 earnings gives us a total of 53. %e A355659 T(2,0) = 2: In this example, we have 2 trials, with 0 losses and 2 wins. In this one single case, the martingale method gives us earnings of +1 and +1 with a total of 2. %Y A355659 Cf. A000225, A070313, A165900. %K A355659 sign,tabl %O A355659 0,4 %A A355659 _Greg Dresden_ and _Max Winnick_, Jul 12 2022