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

A344781 Numbers k such that A070313(k) = 2^k - (2*k+1) is a prime number.

Original entry on oeis.org

4, 7, 8, 28, 32, 81, 669, 1108, 1699, 1839, 2319, 9566, 14866, 30855, 35932, 56048, 70915, 72578
Offset: 1

Views

Author

Amiram Eldar, May 28 2021

Keywords

Comments

The corresponding primes are 7, 113, 239, 268435399, 4294967231, 2417851639229258349412189, ...
If k is a term of this sequence then 2^(k-1)*(2^k-(2*k+1)) is a term of A056075 (see Farideh Firoozbakht's comment in A056075).

Examples

			4 is a term since 2^4 - (2*4+1) = 16 - 9 = 7 is a prime.
7 is a term since 2^7 - (2*7+1) = 128 - 15 = 113 is a prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[2400], PrimeQ[2^# - 2*# - 1] &]

Extensions

a(16)-a(18) from Michael S. Branicky, May 07 2024

A005803 Second-order Eulerian numbers: a(n) = 2^n - 2*n.

Original entry on oeis.org

1, 0, 0, 2, 8, 22, 52, 114, 240, 494, 1004, 2026, 4072, 8166, 16356, 32738, 65504, 131038, 262108, 524250, 1048536, 2097110, 4194260, 8388562, 16777168, 33554382, 67108812, 134217674, 268435400, 536870854, 1073741764, 2147483586
Offset: 0

Views

Author

Keywords

Comments

Starting with n=2, a(n) is the second-order Eulerian number <> (see A008517).
Also, number of 3 X n binary matrices avoiding simultaneously the right-angled numbered polyomino patterns (ranpp) (00;1), (01;0) and (01;1). An occurrence of a ranpp (xy;z) in a matrix A=(a(i,j)) is a triple (a(i1,j1), a(i1,j2), a(i2,j1)) where i1Sergey Kitaev, Nov 11 2004
This is the number of target DNA sequences of the correct length present after each successive cycle of the Polymerase Chain Reaction (PCR). The first two cycles produce 0 target sequences, there are 2 target sequences present after the third cycle, then 8 after the fourth cycle, and so forth. - A. Timothy Royappa, Jun 16 2012
a(n+2) = the row sums of A222403. - J. M. Bergot, Apr 04 2018

Examples

			G.f. = 1 + 2*x^3 + 8*x^4 + 22*x^5 + 52*x^6 + 114*x^7 + 240*x^8 + 494*x^9 + ...
		

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, 2nd ed. Addison-Wesley, Reading, MA, 1994, p. 270.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Equivalent to second column of A008517.
a(n) = A070313 + 1 = A052515 + 2. Bisection of A077866.
Equals for n =>3 the third right hand column of A163936.
Cf. A000918 (first differences).

Programs

  • Haskell
    a005803 n = 2 ^ n - 2 * n
    a005803_list = 1 : f 1 [0, 2 ..] where
       f x (z:zs@(z':_)) = y : f y zs  where y = (x + z) * 2 - z'
    -- Reinhard Zumkeller, Jan 19 2014
    
  • Magma
    [2^n-2*n: n in [0..30]]; // Wesley Ivan Hurt, Jun 04 2014
  • Maple
    A005803:=-2*z/(2*z-1)/(z-1)**2; # conjectured by Simon Plouffe in his 1992 dissertation. Gives sequence except for three leading terms
  • Mathematica
    Table[2^n-2n,{n,0,50}] (* or *) LinearRecurrence[{4,-5,2},{1,0,0},51] (* Harvey P. Dale, May 21 2011 *)
  • PARI
    {a(n) = if( n<0, 0, 2^n - 2*n)}; /* Michael Somos, Oct 13 2002 */
    

Formula

G.f.: 1 + 2*x^3/((1-x)^2*(1-2*x)). a(n) = A008517(n-1, 2). - Michael Somos, Oct 13 2002
Equals binomial transform of [1, -1, 1, 1, 1, ...]. - Gary W. Adamson, Jul 14 2008
a(0) = 1 and a(n) = Sum_{k=0..n-3} ((-1)^(n+k+1)*binomial(2*n-1,k)*stirling1(2*n-k-3,n-k-2)), n=>1. - Johannes W. Meijer, Oct 16 2009
a(0)=1, a(1)=0, a(2)=0, a(n) = 4*a(n-1) - 5*a(n-2) + 2*a(n-3). - Harvey P. Dale, May 21 2011
a(n) = A000225(n+1) - A081494(n+1), n > 1. In other words, a(n) equals the sum of the elements in a Pascal triangle of depth n+1 minus the sum of the elements on its perimeter. - Ivan N. Ianakiev, Jun 01 2014
a(n) = A165900(n-1) + Sum_{i=0..n-1} a(i), for n > 0. - Ivan N. Ianakiev, Nov 24 2014
a(n) = A000225(n) - A005408(n-1). - Miquel Cerda, Nov 25 2016
E.g.f.: exp(x)*(exp(x) - 2*x). - Ilya Gutkovskiy, Nov 25 2016

A165900 a(n) = n^2 - n - 1.

Original entry on oeis.org

-1, -1, 1, 5, 11, 19, 29, 41, 55, 71, 89, 109, 131, 155, 181, 209, 239, 271, 305, 341, 379, 419, 461, 505, 551, 599, 649, 701, 755, 811, 869, 929, 991, 1055, 1121, 1189, 1259, 1331, 1405, 1481, 1559, 1639, 1721, 1805, 1891, 1979, 2069, 2161, 2255
Offset: 0

Views

Author

Philippe Deléham, Sep 29 2009

Keywords

Comments

Previous name was: Values of Fibonacci polynomial n^2 - n - 1.
Shifted version of the array denoted rB(0,2) in A132382, whose e.g.f. is exp(x)(1-x)^2. Taking the derivative gives the e.g.f. of this sequence. - Tom Copeland, Dec 02 2013
The Fibonacci numbers are generated by the series x/(1 - x - x^2). - T. D. Noe, Dec 04 2013
Absolute value of expression f(k)*f(k+1) - f(k-1)*f(k+2) where f(1)=1, f(2)=n. Sign is alternately +1 and -1. - Carmine Suriano, Jan 28 2014 [Can anybody clarify what is meant here? - Joerg Arndt, Nov 24 2014]
Carmine's formula is a special case related to 4 consecutive terms of a Fibonacci sequence. A generalization of this formula is |a(n)| = |f(k+i)*f(k+j) - f(k)*f(k+i+j)|/F(i)*F(j), where f denotes a Fibonacci sequence with the initial values 1 and n, and F denotes the original Fibonacci sequence A000045. The same results can be obtained with the simpler formula |a(n)| = |f(k+1)^2 - f(k)^2 - f(k+1)*f(k)|. Everything said so far is also valid for Fibonacci sequences f with the initial values f(1) = n - 2, f(2) = 2*n - 3. - Klaus Purath, Jun 27 2022
a(n) is the total number of dollars won when using the Martingale method (bet $1, if win then continue to bet $1, if lose then double next bet) for n trials of a wager with exactly one loss, n-1 wins. For the case with exactly one win, n-1 losses, see A070313. - Max Winnick, Jun 28 2022
Numbers m such that 4*m+5 is a square b^2, where b = 2*n -1, for m = a(n). - Klaus Purath, Jul 23 2022

Examples

			G.f. = -1 - x + x^2 + 5*x^3 + 11*x^4 + 19*x^5 + 29*x^6 + 41*x^7 + ... - _Michael Somos_, Mar 23 2023
		

Crossrefs

A028387 and A110331 are very similar sequences.

Programs

Formula

a(n+2) = (n+1)*a(n+1) - (n+2)*a(n).
G.f.: (x^2+2*x-1)/(1-x)^3.
E.g.f.: exp(x)*(x^2-1).
a(n) = - A188652(2*n) for n > 0. - Reinhard Zumkeller, Apr 13 2011
a(n) = A214803(A015614(n+1)) for n > 0. - Reinhard Zumkeller, Jul 29 2012
a(n+1) = a(n) + A005843(n) = A002378(n) - 1. - Ivan N. Ianakiev, Feb 18 2013
a(n+2) = A028387(n). - Michael B. Porter, Sep 26 2018
From Klaus Purath, Aug 25 2022: (Start)
a(2*n) = n*(a(n+1) - a(n-1)) -1.
a(2*n+1) = (2*n+1)*(a(n+1) - a(n)) - 1.
a(n+2) = a(n) + 4*n + 2.
a(n) = A014206(n-1) - 3 = A002061(n-1) - 2.
a(n) = A028552(n-2) + 1 = A014209(n-2) + 2 = 2* A034856(n-2) + 3.
a(n) = A008865(n-1) + n = A005563(n-1) - n.
a(n) = A014209(n-3) + 2*n = A028387(n-1) - 2*n.
a(n) = A152015(n)/n, n != 0.
(a(n+k) - a(n-k))/(2*k) = 2*n-1, for any k.
(End)
For n > 1, 1/a(n) = Sum_{k>=1} F(k)/n^(k+1), where F(n) = A000045(n). - Diego Rattaggi, Nov 01 2022
a(n) = a(1-n) for all n in Z. - Michael Somos, Mar 23 2023
For n > 1, 1/a(n) = Sum_{k>=1} F(2k)/((n+1)^(k+1)), where F(2n) = A001906(n). - Diego Rattaggi, Jan 20 2025
From Amiram Eldar, May 11 2025: (Start)
Sum_{n>=1} 1/a(n) = tan(sqrt(5)*Pi/2)*Pi/sqrt(5).
Product_{n>=3} 1 - 1/a(n) = -sec(sqrt(5)*Pi/2)*Pi/6.
Product_{n>=2} 1 + 1/a(n) = -sec(sqrt(5)*Pi/2)*Pi. (End)

Extensions

a(22) corrected by Reinhard Zumkeller, Apr 13 2011
Better name from Joerg Arndt, Oct 26 2024

A046739 Triangle read by rows, related to number of permutations of [n] with 0 successions and k rises.

Original entry on oeis.org

0, 1, 1, 1, 1, 7, 1, 1, 21, 21, 1, 1, 51, 161, 51, 1, 1, 113, 813, 813, 113, 1, 1, 239, 3361, 7631, 3361, 239, 1, 1, 493, 12421, 53833, 53833, 12421, 493, 1, 1, 1003, 42865, 320107, 607009, 320107, 42865, 1003, 1, 1, 2025, 141549, 1704693, 5494017
Offset: 1

Views

Author

Keywords

Comments

From Emeric Deutsch, May 25 2009: (Start)
T(n,k) is the number of derangements of [n] having k excedances. Example: T(4,2)=7 because we have 3*14*2, 3*4*12, 4*3*12, 2*14*3, 2*4*13, 3*4*21, 4*3*21, each with two excedances (marked). An excedance of a permutation p is a position i such that p(i) > i.
Sum_{k>=1} k*T(n,k) = A000274(n+1). (End)
The triangle 1;1,1;1,7,1;... has general term T(n,k) = Sum_{j=0..n+2} (-1)^(n-j)*C(n+2,j)*A123125(j,k+2) and bivariate g.f. ((1-y)*(y*exp(2*x*y) + exp(x*(y+1))(y^2 - 4*y + 1) + y*exp(2*x)))/(exp(x*y) - y*exp(x))^3. - Paul Barry, May 10 2011
The n-th row is the local h-vector of the barycentric subdivision of a simplex, i.e., the Coxeter complex of type A. See Proposition 2.4 of Stanley's paper below. - Kyle Petersen, Aug 20 2012
T(n,k) is the k-th coefficient of the local h^*-polynomial, or box polynomial, of the s-lecture hall n-simplex with s=(2,3,...,n+1). See Theorem 4.1 of the paper by N. Gustafsson and L. Solus below. - Liam Solus, Aug 23 2018

Examples

			Triangle starts:
  0;
  1;
  1,   1;
  1,   7,   1;
  1,  21,  21,   1;
  1,  51, 161,  51,   1;
  1, 113, 813, 813, 113, 1;
  ...
From _Peter Luschny_, Sep 17 2021: (Start)
The triangle shows the coefficients of the following bivariate polynomials:
  [1] 0;
  [2] x*y;
  [3] x^2*y +     x*y^2;
  [4] x^3*y +   7*x^2*y^2 +     x*y^3;
  [5] x^4*y +  21*x^3*y^2 +  21*x^2*y^3 +     x*y^4;
  [6] x^5*y +  51*x^4*y^2 + 161*x^3*y^3 +  51*x^2*y^4 +     x*y^5;
  [7] x^6*y + 113*x^5*y^2 + 813*x^4*y^3 + 813*x^3*y^4 + 113*x^2*y^5 + x*y^6;
  ...
These polynomials are the permanents of the n X n matrices with all entries above the main antidiagonal set to 'x' and all entries below the main antidiagonal set to 'y'. The main antidiagonals consist only of zeros. Substituting x <- 1 and y <- -1 generates the Euler secant numbers A122045. (Compare with A081658.)
(End)
		

Crossrefs

Cf. A046740.
Row sums give A000166.
Diagonals give A070313, A070315.
T(2n,n) gives A320337.

Programs

  • Maple
    G := (1-t)*exp(-t*z)/(1-t*exp((1-t)*z)): Gser := simplify(series(G, z = 0, 15)): for n to 13 do P[n] := sort(expand(factorial(n)*coeff(Gser, z, n))) end do: 0; for n to 11 do seq(coeff(P[n], t, j), j = 1 .. n-1) end do; # yields sequence in triangular form # Emeric Deutsch, May 25 2009
  • Mathematica
    max = 12; f[t_, z_] := (1-t)*(Exp[-t*z]/(1 - t*Exp[(1-t)*z])); se = Series[f[t, z], {t, 0, max}, {z, 0, max}];
    coes = Transpose[ #*Range[0, max]! & /@ CoefficientList[se, {t, z}]]; Join[{0}, Flatten[ Table[ coes[[n, k]], {n, 2, max}, {k, 2, n-1}]]] (* Jean-François Alcover, Oct 24 2011, after g.f. *)
    E1[n_ /; n >= 0, 0] = 1; (* E1(n,k) are the Eulerian numbers *)
    E1[n_, k_] /; k < 0 || k > n = 0;
    E1[n_, k_] := E1[n, k] = (n-k) E1[n-1, k-1] + (k+1) E1[n-1, k];
    T[n_, k_] := Sum[Binomial[-j-1, -n-1] E1[j, k], {j, 0, n}];
    Table[T[n, k], {n, 1, 100}, {k, 1, n-1}] /. {} -> {0} // Flatten (* Jean-François Alcover, Oct 31 2020, after Peter Luschny in A271697 *)
    Table[Expand[n!Factor[SeriesCoefficient[(x-y)/(x Exp[y t]-y Exp[x t]),{t,0,n}]]],{n,0,12}]//TableForm (* Mamuka Jibladze, Nov 26 2024 *)
  • PARI
    T(n)={my(x='x+O('x^(n+1))); concat([[0]], [Vecrev(p/y) | p<-Vec(-1+serlaplace((y-1)/(y*exp(x)-exp(x*y))))])}
    { my(A=T(10));for(i=1,#A,print(A[i])) } \\ Andrew Howroyd, Nov 13 2024

Formula

a(n+1, r) = r*a(n, r) + (n+1-r)*a(n, r-1) + n*a(n-1, r-1).
exp(-t)/(1 - exp((x-1)t)/(x-1)) = 1 + x*t^2/2! + (x+x^2)*t^3/3! + (x+7x^2+x^3)*t^4/4! + (x+21x^2+21x^3+x^4)*t^5/5! + ... - Philippe Deléham, Jun 11 2004
E.g.f.: (y-1)/(y*exp(x) - exp(x*y)). - Mamuka Jibladze, Nov 08 2024

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 07 2000

A052515 Number of ordered pairs of complementary subsets of an n-set with both subsets of cardinality at least 2.

Original entry on oeis.org

0, 0, 0, 0, 6, 20, 50, 112, 238, 492, 1002, 2024, 4070, 8164, 16354, 32736, 65502, 131036, 262106, 524248, 1048534, 2097108, 4194258, 8388560, 16777166, 33554380, 67108810, 134217672, 268435398, 536870852, 1073741762
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Comments

a(n) is the number of binary sequences of length n having at least two 0's and at least two 1's. a(4)=6 because there are six binary sequences of length four that have two or more 0's and two or more 1's: 0011, 0101, 0110, 1100, 1010, 1001. - Geoffrey Critzer, Feb 11 2009
For n>3, a(n) is also the sum of those terms from the n-th row of Pascal's triangle which also occur in A006987: 6, 10+10, 15+20+15, 21+35+35+21,... - Douglas Latimer, Apr 02 2012
From Dennis P. Walsh, Apr 09 2013: (Start)
Column 2 of triangle A200091.
Number of doubly-surjective functions f:[n]->[2].
Number of ways to distribute n different toys to 2 children so that each child gets at least 2 toys. (End)
a(n) is the number of subsets of an n-set of cardinality k with 2 <= k <= n - 2. - Rick L. Shepherd, Dec 05 2014

Programs

  • Magma
    m:=35; R:=PowerSeriesRing(Rationals(), m); b:=Coefficients(R!( (Exp(x)-1-x)^2 )); [0,0,0,0] cat [Factorial(n+3)*b[n]: n in [1..m-5]]; // G. C. Greubel, May 13 2019
    
  • Maple
    Pairs spec := [S,{S=Prod(B,B),B=Set(Z,2 <= card)},labeled]: seq(combstruct[count](spec,size=n), n=0..20);
  • Mathematica
    Join[{0,0,0}, LinearRecurrence[{4,-5,2}, {0,6,20}, 35]] (* G. C. Greubel, May 13 2019 *)
    With[{nn=30},CoefficientList[Series[(Exp[x]-x-1)^2,{x,0,nn}],x] Range[0,nn]!] (* Harvey P. Dale, May 29 2023 *)
  • PARI
    concat([0,0,0,0],Vec((6-4*x)/(1-x)^2/(1-2*x)+O(x^35))) \\ Charles R Greathouse IV, Apr 03 2012
    
  • PARI
    x='x+O('x^35); concat([0,0,0,0],Vec(serlaplace((exp(x)-x-1)^2))) \\ Joerg Arndt, Apr 10 2013
    
  • Sage
    (2*x^4*(3-2*x)/((1-x)^2*(1-2*x))).series(x, 35).coefficients(x, sparse=False) # G. C. Greubel, May 13 2019

Formula

E.g.f.: (exp(x) - x - 1)^2. - Joerg Arndt, Apr 10 2013
n*a(n+2) - (1+3*n)*a(n+1) + 2(1+n)*a(n) = 0, with a(0) = .. = a(3) = 0, a(4) = 6.
For n>2, a(n) = 2^n - 2n - 2 = A005803(n) - 2 = A070313(n) - 1 = A071099(n) - A071099(n+1) + 1 = 2*A000247(n-1). - Ralf Stephan, Jan 11 2004
G.f.: 2*x^4*(3-2*x)/((1-x)^2*(1-2*x)). - Colin Barker, Feb 19 2012

Extensions

More terms from Ralf Stephan, Jan 11 2004
Definition corrected by Rainer Rosenthal, Feb 12 2010
Definition further clarified by Rick L. Shepherd, Dec 05 2014

A271697 Triangle read by rows, T(n,k) = Sum_{j=0..n} C(-j-1,-n-1)*E1(j,k), E1 the Eulerian numbers A173018, for n>=0 and 0<=k<=n.

Original entry on oeis.org

1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 7, 1, 0, 0, 1, 21, 21, 1, 0, 0, 1, 51, 161, 51, 1, 0, 0, 1, 113, 813, 813, 113, 1, 0, 0, 1, 239, 3361, 7631, 3361, 239, 1, 0, 0, 1, 493, 12421, 53833, 53833, 12421, 493, 1, 0, 0, 1, 1003, 42865, 320107, 607009, 320107, 42865, 1003, 1, 0
Offset: 0

Views

Author

Peter Luschny, Apr 12 2016

Keywords

Examples

			Triangle starts:
  1;
  0, 0;
  0, 1,   0;
  0, 1,   1,   0;
  0, 1,   7,   1,   0;
  0, 1,  21,  21,   1,   0;
  0, 1,  51, 161,  51,   1, 0;
  0, 1, 113, 813, 813, 113, 1, 0;
  ...
		

Crossrefs

Variant: A046739 (main entry for this triangle).
Cf. A000166 (row sums), A122045 (Euler numbers are the alternating row sums), A070313 (col. 2) and (diag. n,n-2).
Cf. A173018.
T(2n,n) gives A320337.

Programs

  • Maple
    A271697 := (n,k) -> add(binomial(-j-1,-n-1)*combinat:-eulerian1(j,k), j=0..n):
    seq(seq(A271697(n, k), k=0..n), n=0..11);
  • Mathematica
    <= 0, 0] = 1;
    E1[n_, k_] /; k < 0 || k > n = 0;
    E1[n_, k_] := E1[n, k] = (n-k) E1[n-1, k-1] + (k+1) E1[n-1, k];
    T[n_, k_] := Sum[Binomial[-j-1, -n-1] E1[j, k], {j, 0, n}];
    Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Oct 29 2020 *)
  • PARI
    T(n)={my(x='x+O('x^(n+1)), v=Vec(serlaplace((y-1)/(y*exp(x)-exp(x*y))))); vector(#v,n,Vecrev(v[n],n))}
    { my(A=T(10)); for(i=1, #A, print(A[i])) } \\ Andrew Howroyd, Nov 13 2024

Formula

T(n,k) = T(n,n-k). - Alois P. Heinz, Oct 29 2020

A209248 a(n) = 2^(2^n - 2*n - 1).

Original entry on oeis.org

2, 128, 2097152, 2251799813685248, 10384593717069655257060992658440192, 883423532389192164791648750371459257913741948437809479060803100646309888
Offset: 3

Views

Author

Jonathan Vos Post, Jan 13 2013

Keywords

Comments

a(n) = 2^A070313(n). Krotov on p. 2: "in general, two extended Hamming codes can intersect in 2^(2^m - 2m - 1) elements."

Examples

			a(5) = 2^(2^5 - 2*5 - 1) = 2^21 = 2097152.
		

Crossrefs

Cf. A070313.

Programs

A347502 Number of dominating sets in the n-cycle complement graph.

Original entry on oeis.org

0, -1, -1, 1, 9, 21, 51, 113, 239, 493, 1003, 2025, 4071, 8165, 16355, 32737, 65503, 131037, 262107, 524249, 1048535, 2097109, 4194259, 8388561, 16777167, 33554381, 67108811, 134217673, 268435399, 536870853, 1073741763, 2147483585, 4294967231, 8589934525
Offset: 0

Views

Author

Eric W. Weisstein, Sep 04 2021

Keywords

Comments

Sequence extended to a(0) using the generating function.

Crossrefs

Cf. A070313.

Formula

a(n) = A070313(n) = 2^n-2*n-1 for n != 4.
G.f.: x^3*(-1 - 5*x + 10*x^2 - 10*x^3 + 4*x^4)/((-1 + x)^2*(-1 + 2*x)).
E.g.f.: exp(2*x) + x^4/12 - exp(x)*(1 + 2*x). - Stefano Spezia, Sep 04 2021

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.

Original entry on oeis.org

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, -12, -51, -63, 7, 41, 97, 111, 41, -57, -113, -127, 8, 55, 159, 243, 187, 5, -163, -239, -255, 9, 71, 242, 458, 500, 248, -130, -394, -493, -511, 10, 89, 349, 784, 1084, 874, 202, -488, -878, -1003, -1023
Offset: 0

Views

Author

Greg Dresden and Max Winnick, Jul 12 2022

Keywords

Comments

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.
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.

Examples

			Triangle T(n,k) begins:
n\k| 0   1   2   3    4   5    6    7    8    9
---+-------------------------------------------
  0| 0
  1| 1  -1
  2| 2   1  -3
  3| 3   5  -1  -7
  4| 4  11   7  -7  -15
  5| 5  19  24   4  -21 -31
  6| 6  29  53  38  -12 -51  -63
  7| 7  41  97 111   41 -57 -113 -127
  8| 8  55 159 243  187   5 -163 -239 -255
  9| 9  71 242 458  500 248 -130 -394 -493 -511
Examples from triangle:
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.
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.
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.
		

Crossrefs

Formula

T(n,k) = T(n-1,k) + T(n-1,k-1) + binomial(n-1,k) for 0 < k < n.
Sum_{k=0..n} T(n,k) = 0 (the sum of each row equals 0).
The following six formulas describe the three leftmost columns and the three rightmost diagonals of the triangle drawn below.
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).
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)).
T(n,2) = (n^3 - 3n^2 - 2)/2.
T(n,n) = 1 - 2^n = A000225(n).
T(n,n-1)= 1 + 2*n - 2^n = A070313(n).
T(n,n-2) = (3*n^2 - n)/2 + 1 - 2^n.
G.f.: x*(1-y)*(1-x*y) / ((1 - x*(1+y))^2 * (1-2*x*y)). - Kevin Ryde, Aug 30 2022
Showing 1-9 of 9 results.