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-10 of 56 results. Next

A049774 Number of permutations of n elements not containing the consecutive pattern 123.

Original entry on oeis.org

1, 1, 2, 5, 17, 70, 349, 2017, 13358, 99377, 822041, 7477162, 74207209, 797771521, 9236662346, 114579019469, 1516103040833, 21314681315998, 317288088082405, 4985505271920097, 82459612672301846, 1432064398910663705, 26054771465540507273, 495583804405888997218
Offset: 0

Views

Author

Tuwani A. Tshifhumulo (tat(AT)caddy.univen.ac.za)

Keywords

Comments

Permutations on n letters without double falls. A permutation w has a double fall at k if w(k) > w(k+1) > w(k+2) and has an initial fall if w(1) > w(2).
Hankel transform is A055209. - Paul Barry, Jan 12 2009
Increasing colored 1-2 trees of order n with choice of two colors for the right branches of the vertices of outdegree 2 except those vertices on the path from the root to the leftmost leaf. - Wenjin Woan, May 21 2011

Examples

			Permutations without double increase and without pattern 123:
a(3) = 5: 132, 213, 231, 312, 321.
a(4) = 17: 1324, 1423, 1432, 2143, 2314, 2413, 2431, 3142, 3214, 3241, 3412, 3421, 4132, 4213, 4231, 4312, 4321.
		

References

  • F. N. David and D. E. Barton, Combinatorial Chance, Hafner, New York, 1962, pp. 156-157.
  • I. P. Goulden and D. M. Jackson, Combinatorial Enumeration, Wiley, N.Y., 1983, (5.2.17).

Crossrefs

Column k=0 of A162975.
Column k=3 of A242784.
Equals 1 + A000303. - Greg Dresden, Feb 22 2020

Programs

  • Maple
    b:= proc(u, o, t) option remember;
         `if`(u+o=0, 1, add(b(u-j, o+j-1, 0), j=1..u)+
         `if`(t=1, 0,   add(b(u+j-1, o-j, 1), j=1..o)))
        end:
    a:= n-> b(n, 0$2):
    seq(a(n), n=0..23);  # Alois P. Heinz, Nov 04 2021
  • Mathematica
    Table[Simplify[ n! SeriesCoefficient[ Series[ Sqrt[3] Exp[x/2]/(Sqrt[3] Cos[Sqrt[3]/2 x] - Sin[Sqrt[3]/2 x]), {x, 0, n}], n] ], {n, 0, 40}]
    (* Second program: *)
    b[u_, o_, t_, k_] := b[u, o, t, k] = If[t == k, (u + o)!, If[Max[t, u] + o < k, 0, Sum[b[u + j - 1, o - j, t + 1, k], {j, 1, o}] + Sum[b[u - j, o + j - 1, 1, k], {j, 1, u}]]];
    a[n_] := b[0, n, 0, 2] - b[0, n, 0, 3] + 1;
    a /@ Range[0, 40] (* Jean-François Alcover, Nov 09 2020, after Alois P. Heinz in A000303 *)

Formula

E.g.f.: 1/Sum_{i>=0} (x^(3*i)/(3*i)! - x^(3*i+1)/(3*i+1)!). [Corrected g.f. --> e.g.f. by Vaclav Kotesovec, Feb 15 2015]
Equivalently, e.g.f.: exp(x/2) * r / sin(r*x + (2/3)*Pi) where r = sqrt(3)/2. This has simple poles at (3*m+1)*x0 where x0 = Pi/sqrt(6.75) = 1.2092 approximately and m is an arbitrary integer. This yields the asymptotic expansion a(n)/n! ~ x0^(-n-1) * Sum((-1)^m * E^(3*m+1) / (3*m+1)^(n+1)) where E = exp(x0/2) = 1.8305+ and m ranges over all integers. - Noam D. Elkies, Nov 15 2001
E.g.f.: sqrt(3)*exp(x/2)/(sqrt(3)*cos(x*sqrt(3)/2) - sin(x*sqrt(3)/2) ); a(n+1) = Sum_{k=0..n} binomial(n, k)*a(k)*b(n-k) where b(n) = number of n-permutations without double falls and without initial falls. - Emanuele Munarini, Feb 28 2003
O.g.f.: A(x) = 1/(1 - x - x^2/(1 - 2*x - 4*x^2/(1 - 3*x - 9*x^2/(1 - ... - n*x - n^2*x^2/(1 - ...))))) (continued fraction). - Paul D. Hanna, Jan 17 2006
a(n) = leftmost column term of M^n*V, where M = an infinite tridiagonal matrix with (1,2,3,...) in the super, sub, and main diagonals and the rest zeros. V = the vector [1,0,0,0,...]. - Gary W. Adamson, Jun 16 2011
E.g.f.: A(x)=1/Q(0); Q(k)=1-x/((3*k+1)-(x^2)*(3*k+1)/((x^2)-3*(3*k+2)*(k+1)/Q(k+1))); (continued fraction). - Sergei N. Gladkovskii, Nov 25 2011
a(n) ~ n! * exp(Pi/(3*sqrt(3))) * (3*sqrt(3)/(2*Pi))^(n+1). - Vaclav Kotesovec, Jul 28 2013
E.g.f.: T(0)/(1-x), where T(k) = 1 - x^2*(k+1)^2/( x^2*(k+1)^2 - (1-x-x*k)*(1-2*x-x*k)/T(k+1) ); (continued fraction). - Sergei N. Gladkovskii, Oct 17 2013

Extensions

Corrected and extended by Vladeta Jovovic, Apr 14 2001

A177523 Number of permutations of 1..n avoiding adjacent step pattern up, up, up, up.

Original entry on oeis.org

1, 1, 2, 6, 24, 119, 709, 4928, 39144, 349776, 3472811, 37928331, 451891992, 5832672456, 81074690424, 1207441809209, 19181203110129, 323753459184738, 5785975294622694, 109149016813544376, 2167402030585724571, 45190632809497874161, 987099099863360190632
Offset: 0

Views

Author

R. H. Hardin, May 10 2010

Keywords

Comments

a(n) is the number of permutations of length n that avoid the consecutive pattern 12345 (or equivalently 54321).

Examples

			E.g.f.: A(x) = 1 + x + 2*x^2/2! + 6*x^3/3! + 24*x^4/4! + 119*x^5/5! + 709*x^6/6! +...
where A(x) = 1/(1 - x + x^5/5! - x^6/6! + x^10/10! - x^11/11! + x^15/15! - x^16/16! + x^20/20! +...).
		

Crossrefs

Column k=15 of A242784.

Programs

  • Mathematica
    Table[n!*SeriesCoefficient[1/(Sum[x^(5*k)/(5*k)!-x^(5*k+1)/(5*k+1)!,{k,0,n}]),{x,0,n}],{n,0,20}] (* Vaclav Kotesovec, Dec 11 2013 *)
    FullSimplify[CoefficientList[Series[10*E^((1+Sqrt[5])*x/4) / ((5+Sqrt[5]) * Cos[Sqrt[(5-Sqrt[5])/2]*x/2] + (5-Sqrt[5]) * E^(Sqrt[5]*x/2) * Cos[Sqrt[(5+Sqrt[5])/2]*x/2] - Sqrt[2*(5-Sqrt[5])] * Sin[Sqrt[(5-Sqrt[5])/2]*x/2] - Sqrt[2*(5+Sqrt[5])] * E^(Sqrt[5]*x/2) * Sin[Sqrt[(5+Sqrt[5])/2]*x/2]),{x,0,20}],x]*Range[0,20]!] (* Vaclav Kotesovec, Aug 29 2014 *)
  • PARI
    {a(n)=n!*polcoeff(1/sum(m=0, n\5+1, x^(5*m)/(5*m)!-x^(5*m+1)/(5*m+1)!+x^2*O(x^n)), n)}

Formula

E.g.f.: 1/( Sum_{n>=0} x^(5*n)/(5*n)! - x^(5*n+1)/(5*n+1)! ).
a(n)/n! ~ c * (1/r)^n, where r = 1.007187547786015395418998654... is the root of the equation Sum_{n>=0} (r^(5*n)/(5*n)! - r^(5*n+1)/(5*n+1)!) = 0, c = 1.02806793756750152.... - Vaclav Kotesovec, Dec 11 2013
Equivalently, r = 1.00718754778601539541899865400272701484... is the root of the equation (5+sqrt(5)) * cos(sqrt((5-sqrt(5))/2)*r/2) + (5-sqrt(5)) * exp(sqrt(5)*r/2) * cos(sqrt((5+sqrt(5))/2)*r/2) - sqrt(2*(5-sqrt(5))) * sin(sqrt((5-sqrt(5))/2)*r/2) - sqrt(2*(5+sqrt(5))) * exp(sqrt(5)*r/2) * sin(sqrt((5+sqrt(5))/2)*r/2) = 0. - Vaclav Kotesovec, Aug 29 2014
E.g.f.: 10*exp((1+sqrt(5))*x/4) / ((5+sqrt(5)) * cos(sqrt((5-sqrt(5))/2)*x/2) + (5-sqrt(5)) * exp(sqrt(5)*x/2) * cos(sqrt((5+sqrt(5))/2)*x/2) - sqrt(2*(5-sqrt(5))) * sin(sqrt((5-sqrt(5))/2)*x/2) - sqrt(2*(5+sqrt(5))) * exp(sqrt(5)*x/2) * sin(sqrt((5+sqrt(5))/2)*x/2)). - Vaclav Kotesovec, Aug 29 2014
In closed form, c = 5*exp((1+sqrt(5))*r/4) / (r*((5 + sqrt(5)) * cos(sqrt((5 - sqrt(5))/2)*r/2) + (5 - sqrt(5)) * exp(sqrt(5)*r/2) * cos(sqrt((5 + sqrt(5))/2)*r/2))) = 1.0280679375675015201596831656779442465978511664638... . Vaclav Kotesovec, Feb 01 2015

Extensions

More terms from Ray Chandler, Dec 06 2011
a(0)=1 prepended by Alois P. Heinz, Jan 13 2015

A242783 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive step pattern given by the binary expansion of n, where 1=up and 0=down; triangle T(n,k), n>=0, read by rows.

Original entry on oeis.org

1, 1, 2, 5, 1, 21, 3, 70, 50, 450, 270, 4326, 602, 99, 12, 1, 34944, 5376, 209863, 139714, 13303, 1573632, 1366016, 530432, 158720, 21824925, 15302031, 2715243, 74601, 302273664, 161855232, 14872704, 2854894485, 2600075865, 712988175, 59062275
Offset: 0

Views

Author

Alois P. Heinz, May 22 2014

Keywords

Comments

Sum_{k>0} k*T(n,k) = A249249(n).

Examples

			T(7,3) = 12 because 12 permutations of {1,2,3,4,5,6,7} have exactly 3 (possibly overlapping) occurrences of the consecutive step pattern up, up, up given by the binary expansion of 7 = 111_2: (1,2,3,4,5,7,6), (1,2,3,4,6,7,5), (1,2,3,5,6,7,4), (1,2,4,5,6,7,3), (1,3,4,5,6,7,2), (2,1,3,4,5,6,7), (2,3,4,5,6,7,1), (3,1,2,4,5,6,7), (4,1,2,3,5,6,7), (5,1,2,3,4,6,7), (6,1,2,3,4,5,7), (7,1,2,3,4,5,6).
Triangle T(n,k) begins:
: n\k :       0        1       2       3  4  ...
+-----+------------------------------------
:  0  :       1;
:  1  :       1;                             [row  1 of A008292]
:  2  :       2;                             [row  2 of A008303]
:  3  :       5,       1;                    [row  3 of A162975]
:  4  :      21,       3;                    [row  4 of A242819]
:  5  :      70,      50;                    [row  5 of A227884]
:  6  :     450,     270;                    [row  6 of A242819]
:  7  :    4326,     602,     99,     12, 1; [row  7 of A220183]
:  8  :   34944,    5376;                    [row  8 of A242820]
:  9  :  209863,  139714,  13303;            [row  9 of A230695]
: 10  : 1573632, 1366016, 530432, 158720;    [row 10 of A230797]
		

Crossrefs

Programs

  • Maple
    T:= proc(n) option remember; local b, k, r, h;
          k:= iquo(n,2,'r'); h:= 2^ilog2(n);
          b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, irem(2*t,   h))*`if`(r=0 and t=k, x, 1), j=1..u)+
          add(b(u+j-1, o-j, irem(2*t+1, h))*`if`(r=1 and t=k, x, 1), j=1..o)))
          end: forget(b);
          (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 0))
        end:
    seq(T(n), n=0..15);
  • Mathematica
    T[n_] := T[n] = Module[{b, k, r, h}, {k, r} = QuotientRemainder[n, 2]; h = 2^Floor[Log[2, n]]; b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Expand[ Sum[b[u - j, o + j - 1, Mod[2*t, h]]*If[r == 0 && t == k, x, 1], {j, 1, u}] + Sum[b[u + j - 1, o - j, Mod[2*t + 1, h]]*If[r == 1 && t == k, x, 1], {j, 1, o}]]]; Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0, 0]]]; Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Feb 20 2016, after Alois P. Heinz *)

A117158 Number of permutations avoiding the consecutive pattern 1234.

Original entry on oeis.org

1, 1, 2, 6, 23, 111, 642, 4326, 33333, 288901, 2782082, 29471046, 340568843, 4263603891, 57482264322, 830335952166, 12793889924553, 209449977967081, 3630626729775362, 66429958806679686, 1279448352687538463, 25874432578888440471, 548178875969847203202
Offset: 0

Views

Author

Steven Finch, Apr 26 2006

Keywords

Comments

a(n) is the number of permutations on [n] that avoid the consecutive pattern 1234. It is the same as the number of permutations which avoid 4321.

References

  • F. N. David and D. E. Barton, Combinatorial Chance, Hafner, New York, 1962, pages 156-157.

Crossrefs

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
          `if`(t<2, add(b(u+j-1, o-j, t+1), j=1..o), 0)+
          add(b(u-j, o+j-1, 0), j=1..u))
        end:
    a:= n-> b(n, 0, 0):
    seq(a(n), n=0..30);  # Alois P. Heinz, Oct 07 2013
  • Mathematica
    a[n_]:=Coefficient[Series[2/(Cos[x]-Sin[x]+Exp[ -x]),{x,0,30}],x^n]*n!
    (* second program: *)
    b[u_, o_, t_] := b[u, o, t] = If[u+o==0, 1, If[t<2, Sum[b[u+j-1, o-j, t+1], {j, 1, o}], 0] + Sum[b[u-j, o+j-1, 0], {j, 1, u}]]; a[n_] := b[n, 0, 0]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Nov 23 2015, after Alois P. Heinz *)

Formula

From Sergei N. Gladkovskii, Nov 30 2011: (Start)
E.g.f.: 2/(exp(-x) + cos(x) - sin(x)) = 1/W(0) with continued fraction
W(k) = 1 + (x^(2*k))/(f + f*x/(4*k + 1 - x - (4*k + 1)*b/R)), where R := x^(2*k) + b -(x^(4*k+1))/(c + (x^(2*k+1)) + x*c/T); T := 4*k + 3 - x - (4*k + 3)*d/(d +(x^(2*k+1))/W(k+1)), and
f := (4*k)!/(2*k)!; b := (4*k + 1)!/(2*k + 1)!; c := (4*k + 2)!/(2*k + 1)!; and d :=(4*k + 3)!/(2*k + 2)!. (End)
a(n) ~ n! / (sin(r)*r^(n+1)), where r = 1.0384156372665563... is the root of the equation exp(-r) + cos(r) = sin(r). - Vaclav Kotesovec, Dec 11 2013

A008303 Triangle read by rows: T(n,k) (n >= 1, 0 <= k <= ceiling(n/2)-1) = number of permutations of [n] with k peaks.

Original entry on oeis.org

1, 2, 4, 2, 8, 16, 16, 88, 16, 32, 416, 272, 64, 1824, 2880, 272, 128, 7680, 24576, 7936, 256, 31616, 185856, 137216, 7936, 512, 128512, 1304832, 1841152, 353792, 1024, 518656, 8728576, 21253376, 9061376, 353792, 2048, 2084864, 56520704, 222398464, 175627264, 22368256
Offset: 1

Views

Author

Keywords

Comments

From Petros Hadjicostas, Aug 06 2019: (Start)
André (1895) first defined these numbers. In his notation, T(n, k) = Q(n+1, 2*(k+1)) for n >= 1 and 0 <= k <= ceiling(n/2)-1.
His triangle is as follows (p. 148):
Q_{2,2}
Q_{3,2}
Q_{4,2} Q_{4,4}
Q_{5,2} Q_{5,4}
Q_{6,2} Q_{6,4} Q_{6,6}
Q_{7,2} Q_{7,4} Q_{7,6}
...
He has Q(n, s) = 0 when either s is odd, or n <= 1, or s > n. Also, Q_{n,2} = 2^(n-2) for n >= 2.
His recurrence is Q(n, s) = s * Q(n-1, s) + (n - s + 1) * Q(n-1, s-2) for n >= 3 and s >= 2. (Obviously, for s odd, we get Q(n, s) = 0 + 0 = 0.)
In terms of the current array, André's (1895) recurrence becomes T(n, k) = (2*k + 2) * T(n-1, k) + (n - 2*k) * T(n-1, k-1) for n >= 2 and 1 <= k <= n with T(n, 0) = 2^(n-1) for n >= 1. In this recurrence, we assume T(n, k) = 0 for k >= ceiling(n/2) or k < 0. (End)
From Petros Hadjicostas, Aug 07 2019: (Start)
We clarify further the quantity Q(n, s) defined by André (1895). In his paper, André considers circular permutations of [n] and deals with maxima, minima, and so-called "séquences" in a permutation.
The term "séquence" in a permutation, as used by André in several of his papers in the 19th century, means a list of consecutive numbers in the permutation that go from a maximum to a minimum, or vice versa, and do not contain any interior minima or maxima. This terminology is also repeated in Ex. 13 (pp. 260-261) by Comtet (even though he refers to the corresponding indices rather than the numbers in the permutation itself).
Some authors call these so-called "séquences" (defined by André and Comtet) "alternate runs" (or just "runs"). Here we are actually dealing with "circular runs" if we read these so-called "séquences" in ascending order in one of the two directions on a circle.
Q(n, s) is the number of circular permutations of [n] (out of the (n-1)! in total) that have exactly s of these so-called "séquences" ("alternate runs").
André (1895) proves that, in a circular permutation of [n], the number of maxima equals the number of minima and that the number of his so-called "séquences" ("alternate runs") is always even (i.e., Q(n, s) = 0 for s odd).
He also shows that, if v = floor(n/2), then the only possible values for the length of a so-called "séquence" ("alternate run") in a circular permutation of [n] are 2, 4, ..., 2*v. That is why Q(n, s) = 0 when either s is odd, or n <= 1, or s > n.
Note that Sum_{t = 1..floor(n/2)} Q_{n, 2*t} = Sum_{t = 1..floor(n/2)} T(n-1, t-1) = (n-1)! = total number of circular permutations of [n].
Since T(n, k) = Q(n+1, 2*(k+1)) for n >= 1 and 0 <= k <= ceiling(n/2)-1, we conclude that the number of (linear) permutations of [n] with k peaks equals the number of circular permutations of [n+1] with exactly 2*(k+1) of these so-called "séquences" ("alternate runs"). (End)
From Petros Hadjicostas, Aug 08 2019: (Start)
The author of this array indirectly assumes that a "peak" of a (linear) permutation of [n] is an interior maximum of the permutation; i.e., we ignore maxima at the endpoints of a permutation.
Similarly, a "valley" of a (linear) permutation of [n] is an interior minimum of the permutation; i.e., we ignore minima at the endpoints of the permutation.
Since the complement of a permutation a_1 a_2 ... a_n (using one-line notation, not cycle notation) is (n+1-a_1) (n+1-a_2) ... (n+1-a_n), it follows that, for n >= 2 and 0 <= k <= ceiling(n/2) - 1, T(n, k) is also the number of (linear) permutations of [n] with exactly k valleys. (End)

Examples

			Triangle T(n,k) (with rows n >= 1 and columns k >= 0) starts as follows:
  [ 1]    1;
  [ 2]    2;
  [ 3]    4,       2;
  [ 4]    8,      16;
  [ 5]   16,      88,      16;
  [ 6]   32,     416,     272;
  [ 7]   64,    1824,    2880,     272;
  [ 8]  128,    7680,   24576,    7936;
  [ 9]  256,   31616,  185856,  137216,    7936;
  [10]  512,  128512, 1304832, 1841152,  353792;
    A000079, A000431, A000487, A000517, A179708, ...
T(3,1) = 2 because we have 132 and 231.
From _Petros Hadjicostas_, Aug 07 2019: (Start)
In terms of André's (1895) notation (see the comments above), we have Q(4, 2) = T(3, 0) = 4 and Q(4, 4) = T(3, 1) = 2.
Out of the (4-1)! = 6 circular permutations of [4], each of the permutations 1324 and 1423 has exactly 4 so-called "séquences" ("alternate runs"), while each of the rest (1234, 1243, 1342, and 1432) has exactly 2 so-called "séquences" ("alternate runs").
In detail, we list the so-called "séquences" ("alternate runs") of the above circular permutations:
  1234 --> 1234 and 41 (maximum 4 and minimum 1).
  1243 --> 124 and 431 (maximum 4 and minimum 1).
  1324 --> 13, 32, 24, and 41 (maxima 3, 4, and minima 1, 2).
  1342 --> 134 and 421 (maximum 4 and minimum 1).
  1423 --> 14, 42, 23, and 31 (maxima 3, 4 and minima 1, 2),
  1432 --> 14 and 4321 (maximum 4 and minimum 1).
(End)
		

References

  • Florence Nightingale David and D. E. Barton, Combinatorial Chance, Charles Griffin, 1962; see Table 10.6, p. 163. [They use the notation T_{N,t^*}^{**}, where N is the length of the permutation and t^* is the number of peaks in the permutation. They also give André's recurrence. So, here n = N and k = t^*. - Petros Hadjicostas, Aug 09 2019]
  • Florence Nightingale David, Maurice George Kendall, and D. E. Barton, Symmetric Functions and Allied Tables, Cambridge, 1966, p. 261, Table 7.3.
  • I. P. Goulden and D. M. Jackson, Combinatorial Enumeration, John Wiley and Sons, N.Y., 1983, Ex. 3.3.46. - Emeric Deutsch, Jul 26 2009
  • T. K. Petersen, Eulerian Numbers, Birkhäuser, 2015, Chapter 4.

Crossrefs

From Emeric Deutsch, Jul 26 2009: (Start)
Sum of entries in row n is n! = A000142(n).
T(n,0) = 2^(n-1) = A000079(n-1).
T(n,1) = A000431(n).
T(n,2) = A000487(n).
T(n,3) = A000517(n).
T(2n, n-1) = T(2n+1, n) = A000182(n+1) (the tangent numbers). (End)
Columns k = 0-6 give: A011782, A000431, A000487, A000517, A179708, A179709, A179710.

Programs

  • Maple
    # The Maple program yields (by straightforward counting) the generating polynomial of the row n specified in the program.
    n := 8: with(combinat): P := permute(n): st := proc (p) local ct, j: ct := 0: for j from 2 to nops(p)-1 do if p[j-1] < p[j] and p[j+1] < p[j] then ct := ct+1 else end if end do: ct end proc: sort(add(t^st(P[j]), j = 1 .. factorial(n))); # Emeric Deutsch, Jul 26 2009
    # Second Maple program:
    a := 1+sqrt(1-t): b := 1-sqrt(1-t): G := (exp(b*z)-exp(a*z))/(b*exp(a*z)-a*exp(b*z)): Gser := simplify(series(G, z = 0, 15)): for n to 12 do P[n] := sort(expand(factorial(n)*coeff(Gser, z, n))) end do: for n to 12 do seq(coeff(P[n], t, j), j = 0 .. ceil((1/2)*n)-1) end do; # yields sequence in triangular form - Emeric Deutsch, Jul 26 2009
    # Third Maple program:
    b:= proc(u, o, t) option remember; expand(`if`(u+o=0, 1,
          add(b(u-j, o+j-1, 0)*x^t, j=1..u)+
          add(b(u+j-1, o-j, 1), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2)):
    seq(T(n), n=1..15);  # Alois P. Heinz, May 22 2014
    # Recurrence of D. André (1895).
    T := proc(n, k) option remember;
    if n < 1 or 2*k > (n-1) then return 0 fi;
    if k = 0 then return 2^(n-1) fi;
    (2*k + 2)*T(n-1, k) + (n - 2*k)*T(n-1, k-1) end:
    seq(seq(T(n, k), k=0..(n-1)/2), n=1..12); # Peter Luschny, Aug 06 2019
  • Mathematica
    From Luc Roy, Jul 08 2010: (Start)
    It appears that one-half of the sequence A008303 can be obtained with this Mathematica program:
    Expand[CoefficientList[Simplify[InverseSeries[Integrate[
    Series[(1 + m Sinh[x]^2)^(-1), {x, 0, 15}, {m, 0, 15}], x]]], x]
    Denominator[CoefficientList[Series[Exp[x], {x, 0, 15}], x]]]
    (* Mathematica Output of Luc Roy's program *)
    {0, 1, 0, 2 m, 0, 8 m + 16 m^2, 0, 32 m + 416 m^2 + 272 m^3, 0, 128 m + 7680 m^2 + 24576 m^3 + 7936 m^4, 0, 512 m + 128512 m^2 + 1304832 m^3 + 1841152 m^4 + 353792 m^5, 0, 2048 m + 2084864 m^2 + 56520704 m^3 + 222398464 m^4 + 175627264 m^5 + 22368256 m^6, 0, 8192 m + 33497088 m^2 + 2230947840 m^3 + 20261765120 m^4 + 41731645440 m^5 + 21016670208 m^6 + 1903757312 m^7}
    (End)
    (* Another Mathematica program *)
    m = 14; a = 1 + Sqrt[1 - t]; b = 1 - Sqrt[1 - t];
    g[z_] = (E^(b*z) - E^(a*z))/(b*E^(a*z) - a*E^(b*z));
    gser = Series[g[z], {z, 0, m}];
    Do[p[n]=n!*Coefficient[gser, z, n]//Simplify, {n, 0, m}];
    Flatten[ Table[ Coefficient[p[n], t, j], {n, 0, m}, {j, 0, Ceiling[n/2] - 1}]]
    (* Jean-François Alcover, May 27 2011, after Emeric Deutsch *)
    (* To get the triangle from Jean-François Alcover's Mathematica program *)
    FormTable[Table[Coefficient[p[n], t, j], {n, 0, m}, {j, 0, Ceiling[n/2] - 1}]]
    (* Petros Hadjicostas, Aug 06 2019 *)
    gf := Sqrt[x - 1] Cot[y Sqrt[x - 1]] - 1; ser := Series[1/gf, {y, 0, 16}];
    cy[n_] := n! Coefficient[ser, y, n]; row[n_] := CoefficientList[cy[n], x];
    Table[row[n], {n, 1, 12}] // Flatten (* Peter Luschny, Aug 06 2019 *)
  • PARI
    {T(n, k) = if(n<1, 0, my(z = sqrt(1 - y + y*O(y^(n\2)))); n!*polcoef(polcoef(z/(z - tanh(x*z)), n, x), k))}; /* Michael Somos, May 24 2023 */

Formula

From Emeric Deutsch, Jul 26 2009: (Start)
E.g.f.: G(t,z)=[exp(bz)-exp(az)]/[b*exp(az)-a*exp(bz)], where a+b=2 and ab=t, i.e., a=1+sqrt(1-t), b=1-sqrt(1-t) (see the Goulden-Jackson reference). -
Sum_{k>=0} k*T(n,k) = n!*(n-2)/3 = A090672(n-1).
Row n has ceiling(n/2) terms. (End)
E.g.f.: tan(t*sqrt(x-1))/(sqrt(x-1)-tan(t*sqrt(x-1))) = Sum_{n>=0} P(n,x)*t^n/n! = t + 2*t^2/2! + (4+2*x)*t^3/3! + (8+16*x)*t^4/4! + .... The row generating polynomials P(n,x) satisfy x^(n-1)*P(n,1+1/x^2) = R(n-1,x), where R(n,x) are the row polynomials of A185896. A000670(n) = (3/2)^(n-1)*P(n,8/9). - Peter Bala, Oct 14 2011
From Jinyuan Wang, Dec 28 2020: (Start)
T(n, k) = (n - 2*k + 2)*T(n-1, k-1) + 2*k*T(n-1, k) for n > 1 and k > 1; T(n, 1) = 2^(n - 1); T(1, k) = 0 for k > 1.
T(2*k-1, k) = A000182(k). (End)
From Ammar Khatab, Aug 17 2024: (Start)
T(2*n,k) = 4^(n-k+1)* Sum_{p=0..k} (-1)^p * (2*p+2*n-2*k-1)/(p+2*n-2*k-1) binomial(p+2*n-2*k-1,p) (A008292(2*n,k-p+1)+A008292(2*n,2*n+p-k) ) for n>0.
T(2*n+1,k) = 4^(n-k)* Sum_{p=0..k} (-1)^p * (p+n-k)/(p+2*n-2*k) binomial(p+2*n-2*k,p) (A008292(2*n+1,k-p+1)+A008292(2*n,2*n+p-k+1) ) for k<>n. (End)

Extensions

Additional comments from Emeric Deutsch, May 08 2004
More terms from R. J. Mathar and Vladeta Jovovic, Jun 26 2007
Corrected by Emeric Deutsch, Jul 26 2009
Edited definition - N. J. A. Sloane, May 25 2023

A162975 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k doubledescents (0 <= k <= n-2). We say that i is a doubledescent (also called a double fall) of a permutation p if p(i) > p(i+1) > p(i+2).

Original entry on oeis.org

1, 1, 2, 5, 1, 17, 6, 1, 70, 41, 8, 1, 349, 274, 86, 10, 1, 2017, 2040, 803, 167, 12, 1, 13358, 16346, 8221, 2064, 316, 14, 1, 99377, 143571, 86214, 28143, 4961, 597, 16, 1, 822041, 1365354, 966114, 374166, 88482, 11486, 1138, 18, 1
Offset: 0

Views

Author

Emeric Deutsch, Jul 26 2009

Keywords

Comments

Row n (n>=2) contains n-1 entries.
Sum of entries in row n is n! = A000142(n).
Sum_{k=0..n-2} k*T(n,k) = A005990(n-1).
The first Maple program yields (by straightforward counting) the generating polynomial of a specified row n.

Examples

			T(5,2) = 8 because we have 15432, 25431, 35421, 43215, 45321, 53214, 54213, and 54312.
Triangle starts:
    1;
    1;
    2;
    5,   1;
   17,   6,   1;
   70,  41,   8,   1;
  349, 274,  86,  10,   1;
		

References

  • I. P. Goulden and D. M. Jackson, Combinatorial Enumeration, Wiley, New York, 1983.

Crossrefs

Programs

  • Maple
    n := 7: dds := proc (p) local ct, j: ct := 0: for j from 3 to nops(p) do if p[j] < p[j-1] and p[j-1] < p[j-2] then ct := ct+1 else end if end do: ct end proc: with(combinat): P := permute(n): f[n] := sort(add(t^dds(P[i]), i = 1 .. factorial(n)));
    # second Maple program:
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, 1), j=1..u)+
          add(b(u+j-1, o-j, 2)*`if`(t=2, x, 1), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 1)):
    seq(T(n), n=0..15);  # Alois P. Heinz, Oct 25 2013
  • Mathematica
    nn=10; u=y-1; a=Apply[Plus, Table[Normal[Series[y x^3/(1-y x - y x^2), {x,0,nn}]][[n]]/(n+2)!, {n,1,nn-2}]]/.y->u; Range[0,nn]! CoefficientList[Series[1/(1-x-a), {x,0,nn}], {x,y}]//Grid  (* Geoffrey Critzer, Dec 12 2012 *)

Formula

E.g.f.: 1/(1 - x - Sum_{k,n} I(n,k)(y - 1)^k*x^n/n!) where I(n,k) is the coefficient of y^k*x^n in the ordinary generating function expansion of y x^3/(1 - y*x - y*x^2). See Flajolet and Sedgewick reference in Links section. - Geoffrey Critzer, Dec 12 2012

A177477 Number of permutations of 1..n avoiding adjacent step pattern up, down, up.

Original entry on oeis.org

1, 1, 2, 6, 19, 70, 331, 1863, 11637, 81110, 635550, 5495339, 51590494, 524043395, 5743546943, 67478821537, 844983073638, 11240221721390, 158365579448315, 2355375055596386, 36870671943986643, 606008531691619131, 10435226671431973345, 187860338952519968538
Offset: 0

Views

Author

Submitted independently by Signy Olafsdottir (signy06(AT)ru.is), May 09 2010 (9 terms) and R. H. Hardin, May 10 2010 (17 terms)

Keywords

Comments

Suppose a < b, c < b, and c < d. To avoid abcd means not to have four consecutive letters such that the first letter is less than the second one, the third letter is less than the second one, and the third letter is less than the last one.

Crossrefs

Column k=0 of A227884.
Column k=5 of A242784.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
           add(b(u-j, o+j-1, [1, 3, 1][t]), j=1..u)+
          `if`(t=3, 0, add(b(u+j-1, o-j, 2), j=1..o)))
        end:
    a:= n-> b(n, 0, 1):
    seq(a(n), n=0..25);  # Alois P. Heinz, Mar 10 2020
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1,
         Sum[b[u - j, o + j - 1, {1, 3, 1}[[t]]], {j, 1, u}] +
         If[t == 3, 0, Sum[b[u + j - 1, o - j, 2], {j, 1, o}]]];
    a[n_] := b[n, 0, 1];
    Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Mar 08 2022, after Alois P. Heinz *)

Formula

a(n) ~ c * d^n * n!, where d = A245758 = 0.7827041801715217018447074977..., c = 2.035127405829990832658061124449458067... . - Vaclav Kotesovec, Aug 22 2014

Extensions

a(18)-a(23) from Alois P. Heinz, Oct 06 2013
a(0)=1 prepended by Alois P. Heinz, Mar 10 2020

A242819 Number T(n,k) of permutations of [n] with exactly k occurrences of the consecutive step pattern up, down, down; triangle T(n,k), n>=0, 0<=k<=max(0,floor((n-1)/3)), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 21, 3, 90, 30, 450, 270, 2619, 2322, 99, 17334, 20772, 2214, 129114, 195372, 38394, 1067661, 1958337, 591543, 11259, 9713682, 20933154, 8826246, 443718, 96393726, 238789782, 131367258, 12450834, 1036348587, 2900868876, 1989555210, 297195804, 3052323
Offset: 0

Views

Author

Alois P. Heinz, May 23 2014

Keywords

Comments

T(n,k) is also the number of permutations of [n] with exactly k occurrences of the consecutive step pattern up, up, down.
From Vaclav Kotesovec, Aug 26 2014: (Start)
Column k is asymptotic to c(k) * (3*sqrt(3)/(2*Pi))^n * n! * n^k.
Conjecture: c(k) = c(0) * (c(0)-1)^k / (3^k * k!).
Verified numerically:
c(0) = 1.96650951227123825842868... = (1+exp(Pi/sqrt(3)))*sqrt(3)/(2*Pi)
c(1) = 0.63355004986067503869384...
c(2) = 0.10205535828170995196503...
c(3) = 0.01095971939528021798...
c(4) = 0.000882722753946826148...
c(5) = 0.00005687732922585807984...
c(6) = 0.000003054026651631929902...
c(7) = 0.0000001405593242634352116...
c(8) = 0.00000000566049683079281633...
c(9) = 0.0000000002026268159682390665...
c(10)= 0.00000000000652802483581788974...
c(20)= 1.172921625090753...*10^(-28)
c(30)= 1.2959323...*10^(-47)
c(40)= 5.0751...*10^(-68)
(End)

Examples

			T(4,1) = 3: (1,4,3,2), (2,4,3,1), (3,4,2,1).
Triangle T(n,k) begins:
:  0 :       1;
:  1 :       1;
:  2 :       2;
:  3 :       6;
:  4 :      21,        3;
:  5 :      90,       30;
:  6 :     450,      270;
:  7 :    2619,     2322,      99;
:  8 :   17334,    20772,    2214;
:  9 :  129114,   195372,   38394;
: 10 : 1067661,  1958337,  591543,  11259;
: 11 : 9713682, 20933154, 8826246, 443718;
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, [1, 3, 1][t])*`if`(t=3, x, 1), j=1..u)+
          add(b(u+j-1, o-j, 2), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 1)):
    seq(T(n), n=0..15);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u+o == 0, 1, Expand[Sum[b[u-j, o+j-1, {1, 3, 1}[[t]]]*If[t == 3, x, 1], {j, 1, u}] + Sum[b[u+j-1, o-j, 2], {j, 1, o}]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0, 1]]; Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Feb 10 2015, after Alois P. Heinz *)

A177479 Number of permutations of 1..n avoiding adjacent step pattern up, down, down.

Original entry on oeis.org

1, 1, 2, 6, 21, 90, 450, 2619, 17334, 129114, 1067661, 9713682, 96393726, 1036348587, 11998603710, 148842430470, 1969461102357, 27688474234602, 412166988789642, 6476330295597051, 107117619952992966, 1860296912926495938, 33845967939906741213, 643778989807702357314
Offset: 0

Views

Author

Submitted independently by Signy Olafsdottir (signy06(AT)ru.is), May 09 2010 (9 terms) and R. H. Hardin, May 10 2010 (17 terms)

Keywords

Comments

Suppose j

Crossrefs

Column k=0 of A242819.
Columns k=4,6 of A242784.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
           add(b(u+j-1, o-j, 1), j=1..o)+ `if`(t<2,
           add(b(u-j, o+j-1, `if`(t=0, 0, 2)), j=1..u), 0))
        end:
    a:= n-> b(n, 0, 0):
    seq(a(n), n=0..30);  # Alois P. Heinz, Oct 07 2013
  • Mathematica
    FullSimplify[Rest[CoefficientList[Series[(E^(3*x/2) + 2*Cos[Sqrt[3]*x/2]) / (3*Cos[Sqrt[3]*x/2] - Sqrt[3]*Sin[Sqrt[3]*x/2]), {x, 0, 20}], x] * Range[0, 20]!]] (* Vaclav Kotesovec, Aug 23 2014 *)

Formula

E.g.f.: (exp(3*x/2) + 2*cos(sqrt(3)*x/2)) / (3*cos(sqrt(3)*x/2) - sqrt(3)*sin(sqrt(3)*x/2)). - Vaclav Kotesovec, Aug 23 2014
a(n) ~ n! * (1+exp(Pi/sqrt(3))) * 3^(3*n/2+1/2) / (2*Pi)^(n+1). - Vaclav Kotesovec, Aug 23 2014

Extensions

a(18)-a(23) from Alois P. Heinz, Oct 06 2013

A177533 Number of permutations of 1..n avoiding adjacent step pattern up, up, up, up, up.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 719, 5027, 40168, 361080, 3606480, 39623760, 474915803, 6166512899, 86227808578, 1291868401830, 20645144452320, 350547210173280, 6302294420371031, 119600213982762899, 2389140113204434900, 50111866901959213980, 1101140993932295832120
Offset: 0

Author

R. H. Hardin, May 10 2010

Keywords

Comments

a(n) is the number of permutations of length n that avoid the consecutive pattern 123456 (or equivalently 654321).

Crossrefs

Column k=31 of A242784.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
          `if`(t<4, add(b(u+j-1, o-j, t+1), j=1..o), 0)+
          add(b(u-j, o+j-1, 0), j=1..u))
        end:
    a:= n-> b(n, 0, 0):
    seq(a(n), n=0..30);  # Alois P. Heinz, Oct 07 2013
  • Mathematica
    Table[n!*SeriesCoefficient[1/(Sum[x^(6*k)/(6*k)!-x^(6*k+1)/(6*k+1)!,{k,0,n}]),{x,0,n}],{n,1,20}] (* Vaclav Kotesovec, Dec 11 2013 *)
    Rest[CoefficientList[Series[3/(E^(x/2) * Cos[x*Sqrt[3]/2+Pi/3] + Sqrt[3] * E^(-x/2) * Cos[x*Sqrt[3]/2+Pi/6] + E^(-x)),{x,0,20}],x] * Range[0,20]!] (* Vaclav Kotesovec, Aug 23 2014 *)

Formula

a(n)/n! ~ 1.005827831279392186... * (1/r)^n, where r = 1.0011988273240623031887... is the root of the equation Sum_{n>=0} (r^(6*n)/(6*n)! - r^(6*n+1)/(6*n+1)!) = 0. - Vaclav Kotesovec, Dec 11 2013
Equivalently, a(n)/n! ~ c * (1/r)^n, where r = 1.00119882732406230318870210972855430833421618931012450844128... is the root of the equation 2 + exp(r/2) * (3 + exp(r)) * cos(sqrt(3)*r/2) = 2 * sqrt(3) * exp(r) * cosh(r/2) * sin(sqrt(3)*r/2), c = sqrt(3) / (2 * r * cosh(r/2) * sin(sqrt(3)*r/2)) = 1.0058278312793921866941324506580803251270892126827302878865925027445... . - Vaclav Kotesovec, Aug 23 2014
E.g.f. (Aldred, Atkinson, McCaughan, 2010): 3/(exp(x/2) * cos(x*sqrt(3)/2+Pi/3) + sqrt(3) * exp(-x/2) * cos(x*sqrt(3)/2+Pi/6) + exp(-x)). - Vaclav Kotesovec, Aug 23 2014

Extensions

More terms from Ray Chandler, Dec 06 2011
Minor edits by Vaclav Kotesovec, Aug 29 2014
a(0)=1 prepended by Alois P. Heinz, Aug 08 2018
Showing 1-10 of 56 results. Next