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 11 results. Next

A028399 a(n) = 2^n - 4.

Original entry on oeis.org

0, 4, 12, 28, 60, 124, 252, 508, 1020, 2044, 4092, 8188, 16380, 32764, 65532, 131068, 262140, 524284, 1048572, 2097148, 4194300, 8388604, 16777212, 33554428, 67108860, 134217724, 268435452, 536870908, 1073741820, 2147483644, 4294967292, 8589934588, 17179869180
Offset: 2

Views

Author

Keywords

Comments

Number of permutations of [n] with 2 sequences.
Number of 2 X n binary matrices that avoid simultaneously the right angled numbered polyomino patterns (ranpp) (00;1) and (11;0). 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
The number of edges in the dual Edwards-Venn diagram graph with n-1 digits when n>2.
a(n) (n>=6) is the number of vertices in the molecular graph NS2[n-5], defined pictorially in the Ashrafi et al. reference (Fig. 2, where NS2[2] is shown). - Emeric Deutsch, May 16 2018
From Petros Hadjicostas, Aug 08 2019: (Start)
With regard to the comment above about a(n) being the "number of permutations of [n] with 2 sequences", we refer to Ex. 13 (pp. 260-261) of Comtet (1974), who uses the definition of a "séquence" given by André in several of his papers in the 19th century.
In the terminology of array A059427, these so-called "séquences" in permutations (defined by Comtet and André) are called "alternating runs" (or just "runs"). We discuss these so-called "séquences" below.
If b = (b_1, b_2, ..., b_n) is a permutation of [n], written in one-line notation (not in cycle notation), a "séquence" in a permutation of length l >= 2 (according to Comtet) is a maximal interval of integers {i, i+1, ..., i+l-1} for some i (where 1 <= i <= n-l+1) such that b_i < b_{i+1} < ... < b_{i+l-1} or b_i > b_{i+1} > ... > b_{i+l-1}. (The word "maximal" means that, in the first case, we have b_{i-1} > b_i and b_{i+l} < b_{i+l-1}, while in the second case, we have b_{i-1} < b_i and b_{i+l} > b_{i+l-1} provided b_{i-1} and b_{i+l} can be defined.)
When defining a "séquence", André (1884) actually refers to the list of terms (b_i, b_{i+1}, ..., b_{i+l-1}) rather than the corresponding index set {i, i+1, ..., i+l-1} (which is essentially the same thing).
For more details about these so-called "séquences" (or "alternate runs"), see the comments and examples for sequence A000708.
(End)
For n >= 1, a(n+2) is the number of shortest paths from (0,0) of a square grid to {(x,y): |x|+|y| = n} along the grid line. - Jianing Song, Aug 23 2021

Examples

			From _Petros Hadjicostas_, Aug 08 2019: (Start)
We have a(3) = 4 because each of the following permutations of [3] has the following so-called "séquences" ("alternate runs"):
   123 -> 123 (one),
   132 -> 13, 32 (two),
   213 -> 21, 13 (two),
   231 -> 23, 31 (two),
   312 -> 31, 12 (two),
   321 -> 321 (one).
Recall that a so-called "séquence" ("alternate run") must start with a "maximum" and end with "minimum", or vice versa, and it should not contain any other maxima and minima in between. Two consecutive such "séquences" ("alternate runs") have exactly one minimum or exactly one maximum in common.
(End)
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 261.
  • A. W. F. Edwards, Cogwheels of the Mind, Johns Hopkins University Press, 2004, p. 82.

Crossrefs

Column k = 2 of A059427.
Row n = 2 of A371064.

Programs

  • GAP
    a:=List([2..40], n->2^n-4); # Muniru A Asiru, May 17 2018
    
  • Maple
    seq(2^n-4, n=2..40); # Muniru A Asiru, May 17 2018
  • Mathematica
    2^Range[2,40]-4 (* Harvey P. Dale, Jul 05 2019 *)
  • PARI
    a(n)=if(n<2, 0, 2^n-4)
    
  • Python
    def A028399(n): return (1<Chai Wah Wu, Jun 27 2023

Formula

O.g.f.: 4*x^3/((1-x)*(1-2*x)). - R. J. Mathar, Aug 07 2008
From Reinhard Zumkeller, Feb 28 2010: (Start)
a(n) = A175164(2*n)/A140504(n+2);
a(2*n) = A052548(n)*A000918(n) for n > 0;
a(n) = A173787(n,2). (End)
a(n) = a(n-1) + 2^(n-1) (with a(2)=0). - Vincenzo Librandi, Nov 22 2010
a(n) = 4*A000225(n-2). - R. J. Mathar, Dec 15 2015
E.g.f.: 3 + 2*x - 4*exp(x) + exp(2*x). - Stefano Spezia, Apr 06 2021
a(n) = sigma(A003945(n-2)) for n>=3. - Flávio V. Fernandes, Apr 20 2021

Extensions

Additional comments from Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Dec 02 2001

A008970 Triangle T(n,k) = P(n,k)/2, n >= 2, 1 <= k < n, of one-half of number of permutations of 1..n such that the differences have k runs with the same signs.

Original entry on oeis.org

1, 1, 2, 1, 6, 5, 1, 14, 29, 16, 1, 30, 118, 150, 61, 1, 62, 418, 926, 841, 272, 1, 126, 1383, 4788, 7311, 5166, 1385, 1, 254, 4407, 22548, 51663, 59982, 34649, 7936, 1, 510, 13736, 100530, 325446, 553410, 517496, 252750, 50521, 1, 1022, 42236, 433162, 1910706, 4474002, 6031076, 4717222, 1995181, 353792
Offset: 2

Views

Author

Keywords

Examples

			Triangle starts
  1;
  1,  2;
  1,  6,   5;
  1, 14,  29,  16;
  1, 30, 118, 150, 61;
  ...
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 261, #13, P_{n,k}.
  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 260, Table 7.2.1.

Crossrefs

A059427 gives triangle of P(n, k).
A008303 gives circular version of P(n, k).
T(2n,n) gives A360426.

Programs

  • Maple
    T:= proc(n, k) option remember; `if`(n<2, 0, `if`(k=1, 1,
          k*T(n-1, k) + 2*T(n-1, k-1) + (n-k)*T(n-1, k-2)))
        end:
    seq(seq(T(n,k), k=1..n-1), n=2..12);  # Alois P. Heinz, Feb 08 2023
  • Mathematica
    p[n_ /; n >= 2, 1] = 2; p[n_ /; n >= 2, k_] /; 1 <= k <= n := p[n, k] = k*p[n-1, k] + 2*p[n-1, k-1] + (n-k)*p[n-1, k-2]; p[n_, k_] = 0; t[n_, k_] := p[n, k]/2; A008970 = Flatten[ Table[ t[n, k], {n, 2, 11}, {k, 1, n-1}]] (* Jean-François Alcover, Apr 03 2012, after given recurrence *)

Formula

Let P(n, k) = number of permutations of [1..n] with k "sequences". Note that A008970 gives P(n, k)/2. Then g.f.: Sum_{n, k} P(n, k) *u^k * t^n/n! = (1 + u)^(-1) * ((1 - u) * (1 - sin(v + t * cos(v))-1) where u = sin(v).
P(n, 1) = 2, P(n, k) = k*P(n-1, k) + 2*P(n-1, k-1) + (n-k)*P(n-1, k-2).

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Feb 01 2001

A000708 a(n) = E(n+1) - 2*E(n), where E(i) is the Euler number A000111(i).

Original entry on oeis.org

-1, -1, 0, 1, 6, 29, 150, 841, 5166, 34649, 252750, 1995181, 16962726, 154624469, 1505035350, 15583997521, 171082318686, 1985148989489, 24279125761950, 312193418011861, 4210755676649046, 59445878286889709, 876726137720576550, 13483686390543382201
Offset: 0

Views

Author

Keywords

Comments

a(n) mod 10 for n >= 2 is the periodic sequence repeat: 0, 1, 6, 9.
For n >= 2, a(n) is the number of permutations on [n] that have n-2 "sequences" (which are maximal monotone runs in Comtet terminology) and start increasing. - Michael Somos, Aug 28 2013
From Petros Hadjicostas, Aug 07 2019: (Start)
With regard to the comment by Michael Somos above, a "sequence" in a permutation according to Ex. 13 (pp. 260-261) of Comtet (1974) is actually a "séquence" in a permutation according to André. He uses this terminology in several of his papers cited in the links below.
In the terminology of array A059427, these so-called "séquences" in permutations defined by Comtet and André are called "alternate runs" (or just "runs"). We discuss these so-called "sequences" below.
We clarify that a(n) is actually one-half the number of permutations on [n] that have n-2 "séquences" as defined by Comtet and André.
André (1884) defines a "maximum" of a permutation of [n] to be any number in the permutation that is greater than both of its neighbors, if it is an interior number, or greater than its single neighbor, if it is either at the beginning or at the end of the permutation.
André (1884) also defines a "minimum" of a permutation of [n] to be any number in the permutation that is less than both of its neighbors, if it is an interior number, or less than its single neighbor, if it is either at the beginning or at the end of the permutation.
A "séquence" in a permutation of [n] according to André and Comtet is a list of consecutive numbers in the permutation that begins with a maximum and ends with a minimum, or vice versa, but has no interior maxima and minima. As mentioned above, other authors call these so-called "séquences" "alternate runs" (or just "runs").
For example, in the permutation 78125436 of [8], we have three maxima, 8, 5, and 6; three minima, 7, 1, and 3; and the so-called "séquences" ("alternate runs") 78, 81, 125, 543, 36 (see p. 122 in André (1884)).
If in the above permutation we take the difference 8-7, 1-8, 2-1, 5-2, 4-5, 3-4, 6-3, we may form a word (list) of signs of consecutive differences: +-++--+.
In general, if in a permutation of [n], say a_1,a_2,...,a_n (written in one-line notation, but not in cycle notation), we form the differences a_2 - a_1, a_3 - a_2, ..., a_n - a_{n-1}, then we get a list of n-1 signs (+ or -).
For n >= 2, André (1885) calls a permutation of [n] "alternate" if it has n - 1 so-called "séquences" ("alternate runs"); i.e., if the corresponding list of signs alternates between + and -. See the documentation and references for sequences A000111 and A001250.
For n >= 2, André (1885) calls a permutation of [n] "quasi-alternate" if it has n - 2 so-called "séquences" ("alternate runs"); i.e., if the corresponding list of signs alternates between + and - except for a single ++ or a single --, but not both.
In the above example, the permutation 78125436 has 5 so-called "séquences" ("alternate signs") and 5 < 8-2 < 8-1; that is, it is neither alternate nor quasi-alternate. We can reach the same conclusion by looking at its corresponding list of signs +-++--+. The permutation is neither alternate nor quasi-alternate because we have one ++ and one --.
On p. 316, André (1885) gives the following two examples of permutations of [8]: 31426587 and 32541768 (using one-line notation for permutations). The first one has list of signs -+-+-+- while the second one has list of signs -+--+-+. The first one is alternate while the second one is quasi-alternate (because of a single --). Alternatively, the first one has n-1 = 7 so-called "séquences" ("alternate runs")--31, 14, 42, 26, 65, 58, 87--while the second one has n-2 = 6 so-called "séquences" ("alternate runs")--32, 25, 541, 17, 76, 68.
Here 2*a(n) is the total number of quasi-alternate permutations of [n]. Actually, André (1884, 1885) uses P_{n,s} to denote the number of permutations of [n] with exactly s of his so-called "séquences" ("alternate runs"). He uses the notation A_n to denote half the number of alternate permutations of [n] and B_n to denote half the number of quasi-alternate permutations of [n].
Thus, P_{n,n-1} = 2*A_n = 2*A000111(n) = A001250(n) for n >= 2 and P_{n,n-2} = 2*B_n = 2*a(n) for n >= 2.
We have P_{n,s} = A059427(n,s) for n >= 2 and s >= 1. See also p. 261 in Comtet (1974). They satisfy André's recurrence P_{n,s} = s*P_{n-1,s} + 2*P_{n-1,s-1} + (n-s)*P_{n-1,s-2} for n >= 3 and s >= 3 with P(n, 1) = 2 for n >= 2 and P(n, s) = 0 for s >= n.
The numbers Q(n,s) that count the circular permutations of [n] with exactly s so-called "séquences" ("alternate runs") appear in array A008303. They have also been studied by Désiré André (see the references there).
(End)

Examples

			G.f. = -1 - x + x^3 + 6*x^4 + 29*x^5 + 150*x^6 + 841*x^7 + 5166*x^8 + 34649*x^9 + ...
a(3) = 1 with permutation 123. a(4) = 6 with permutations 1243, 1342, 1432, 2341, 2431, 3421.
From _Petros Hadjicostas_, Aug 07 2019: (Start)
We elaborate on the example above. For the permutations of [3], we have the following sign sequences:
123 -> ++; 132 --> +-; 213 -> -+; 213 -> 213; 231 -> +-; 312 -> -+; 321 --> --.
Thus, 123 and 321 are quasi-alternate and a(3) = 2/2 = 1.
For the permutations of [4] we have:
  1234 -> +++ (neither alternate nor quasi-alternate);
  1243 -> ++- (quasi-alternate);
  1324 -> +-+ (alternate);
  1342 -> ++- (quasi-alternate);
  1423 -> +-+ (alternate);
  1432 -> +-- (quasi-alternate);
  2134 -> -++ (quasi-alternate);
  2143 -> -+- (alternate);
  2314 -> +-+ (alternate);
  2341 -> ++- (quasi-alternate);
  2413 -> +-+ (alternate);
  2431 -> +-- (quasi-alternate);
  3124 -> -++ (quasi-alternate);
  3142 -> -+- (alternate);
  3214 -> --+ (quasi-alternate);
  3241 -> -+- (alternate);
  3412 -> +-+ (alternate);
  3421 -> +-- (quasi-alternate);
  4123 -> -++ (quasi-alternate);
  4132 -> -+- (alternate);
  4213 -> --+ (quasi-alternate);
  4231 -> -+- (alternate);
  4312 -> --+ (quasi-alternate);
  4321 -> --- (neither alternate nor quasi-alternate).
Thus we have 10 = 2*A000111(4) = A001250(4) alternate permutations of [4] and 2*a(4) = 2*6 = 12 quasi-alternate permutations of [4]. The remaining 2 permutations (1234 and 4321) each have one so-called "séquence" ("alternate run").
Thus, P_{n=4, s=1} = 2, P_{n=4, s=2} = 12, and P_{n=4, s=10} = 10 (see row n = 4 for array A059427).
(End)
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 261.
  • E. Netto, Lehrbuch der Combinatorik. 2nd ed., Teubner, Leipzig, 1927, p. 113.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Apart from initial terms, equals (1/2)*A001758. A diagonal of A008970.

Programs

  • Maple
    seq(i! * coeff(series((1 + (tan(t) + sec(t))^2 - 4*(tan(t) + sec(t))) / 2, t, 35), t, i), i=0..24); # Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Mar 12 2001
  • Mathematica
    a[ n_] := If[ n < 0, 0, n! SeriesCoefficient[ (1 - 2 Cos[x]) / (1 - Sin[x]), {x, 0, n}]]; (* Michael Somos, Aug 28 2013 *)
    nmax = 22; ee = Table[2^n*EulerE[n, 1] + EulerE[n], {n, 0, nmax+1}]; dd = Table[Differences[ee, n][[1]] // Abs, {n, 0, nmax+1}]; a[n_] := dd[[n+2]] - 2dd[[n+1]]; a[0] = -1; Table[a[n], {n, 0, nmax}] (* Jean-François Alcover, Feb 10 2016, after Paul Curtz *)
    Table[If[n == 0, -1, 2 Abs[PolyLog[-n-1, I]] - 4 Abs[PolyLog[-n, I]]], {n, 0, 22}] (* Jean-François Alcover, Jul 01 2017 *)
  • PARI
    x='x+O('x^99); Vec(serlaplace((1-2*cos(x))/(1-sin(x))))
    
  • Python
    from mpmath import polylog, j, mp
    mp.dps=20
    def a(n): return -1 if n==0 else int(2*abs(polylog(-n - 1, j)) - 4*abs(polylog(-n, j)))
    print([a(n) for n in range(23)])  # Indranil Ghosh, Jul 02 2017
    
  • Python
    from itertools import count, islice, accumulate
    def A000708_gen(): # generator of terms
        yield -1
        blist = (0,1)
        for n in count(2):
            yield -2*blist[-1]+(blist:=tuple(accumulate(reversed(blist),initial=0)))[-1]
    A000708_list = list(islice(A000708_gen(),40)) # Chai Wah Wu, Jun 09-11 2022

Formula

E.g.f.: (1 - 2*cos(x)) / (1 - sin(x)).
a(n) ~ n! * 2*n*(2/Pi)^(n+2). - Vaclav Kotesovec, Oct 08 2013
a(n) = 2*abs(PolyLog(-n-1, i)) - 4*abs(PolyLog(-n, i)) for n > 0, with a(0) = -1. - Jean-François Alcover, Jul 02 2017

Extensions

More terms from Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Mar 12 2001
Corrected and extended by T. D. Noe, Oct 25 2006
Edited by N. J. A. Sloane, Aug 27 2012

A186370 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k up-down runs (1 <= k <= n).

Original entry on oeis.org

1, 1, 1, 1, 3, 2, 1, 7, 11, 5, 1, 15, 43, 45, 16, 1, 31, 148, 268, 211, 61, 1, 63, 480, 1344, 1767, 1113, 272, 1, 127, 1509, 6171, 12099, 12477, 6551, 1385, 1, 255, 4661, 26955, 74211, 111645, 94631, 42585, 7936, 1, 511, 14246, 114266, 425976, 878856, 1070906, 770246, 303271, 50521
Offset: 1

Views

Author

Emeric Deutsch and Ira M. Gessel, Mar 01 2011

Keywords

Comments

The up-down runs of a permutation p are the alternating runs of the permutation p endowed with a 0 in the front. For example, 75814632 has 6 up-down runs: 07, 75, 58, 81, 146, and 632.

Examples

			T(3,2) = 3 because we have 132, 231, and 321.
T(4,4) = 5 because we have 13254, 14253, 14352, 15243, and 15342 (the up-down permutations).
Triangle starts:
1;
1,  1;
1,  3,  2;
1,  7, 11,  5;
1, 15, 43, 45, 16;
		

Crossrefs

Row sums give A000142.
T(2n,n) gives A291677, T(2n+1,n+1) gives A303159, T(n,ceiling(n/2)) gives A303160.

Programs

  • Maple
    w := sqrt(1-t^2): G := (w^2+t*w*sinh(z*w))/((1+t)*(1-t*cosh(z*w)))-1: Gser := simplify(series(G, z = 0, 12)): for n to 10 do P[n] := sort(expand(factorial(n)*coeff(Gser, z, n))) end do: for n to 10 do seq(coeff(P[n], t, k), k = 1 .. n) end do; # yields sequence in triangular form
    # second Maple program:
    b:= proc(u, o) option remember; expand(`if`(u+o=0, 1,
           add(b(o+j-1, u-j)*x, j=1..u)+
           add(b(u+j-1, o-j),   j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(n, 0)):
    seq(T(n), n=1..12);  # Alois P. Heinz, Aug 29 2017, Apr 17 2018
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = Expand[If[u + o == 0, 1, Sum[b[u - j, o + j - 1, 0]*x^t, {j, 1, u}] + Sum[b[u + j - 1, o - j, 1]*x^(1-t), {j, 1, o}]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 1, n}]][b[0, n, 0]];
    Table[T[n], {n, 1, 12}] // Flatten (* Jean-François Alcover, Nov 06 2017, after Alois P. Heinz *)
  • Sage
    @CachedFunction
    def A186370(n, k):
        if n == 0 or  k == 0: return 0
        if n == 1 and k == 1: return 1
        return k*A186370(n-1, k) + A186370(n-1, k-1) + (n-k+1)*A186370(n-1, k-2)
    for n in (1..7): [A186370(n, k) for k in (1..n)] # Peter Luschny, Apr 18 2014

Formula

T(n,2) = 2^{n-1}-1 = A000225(n-1).
T(n,n) = A000111(n) (the Euler or up-down numbers).
Sum_{k=1..n} k*T(n,k) = A186371(n).
E.g.f.: G(t,z) = Sum_{n>=1} Sum_{k>=1} T(n,k) * t^k * z^n / n! = (w^2 + tw*sinh(zw))/[(1+t)(1-t*cosh(zw))]-1, where w=sqrt(1-t^2).
The e.g.f. G(t,z) satisfies the linear homogeneous partial differential equation (1-t^2*z)(dG/dz)-t(1-t^2)dG/dt = tG; G(0,z)=1.
Recurrence: T(n,k) = k*T(n-1,k) + T(n-1,k-1) + (n-k+1)*T(n-1,k-2); T(n,0) = T(0,k) = 0, T(1,1) = 1.

A226441 T(n,k) = number of permutations of {1..n} with fewer than k interior elements having values lying between the values of their neighbors.

Original entry on oeis.org

1, 1, 2, 1, 2, 4, 1, 2, 6, 10, 1, 2, 6, 22, 32, 1, 2, 6, 24, 90, 122, 1, 2, 6, 24, 118, 422, 544, 1, 2, 6, 24, 120, 658, 2226, 2770, 1, 2, 6, 24, 120, 718, 4078, 13102, 15872, 1, 2, 6, 24, 120, 720, 4914, 27724, 85170, 101042, 1, 2, 6, 24, 120, 720, 5038, 37300, 205134, 606542, 707584
Offset: 1

Views

Author

R. H. Hardin, Jun 06 2013

Keywords

Comments

Table starts
.......1........1.........1.........1.........1.........1.........1.........1
.......2........2.........2.........2.........2.........2.........2.........2
.......4........6.........6.........6.........6.........6.........6.........6
......10.......22........24........24........24........24........24........24
......32.......90.......118.......120.......120.......120.......120.......120
.....122......422.......658.......718.......720.......720.......720.......720
.....544.....2226......4078......4914......5038......5040......5040......5040
....2770....13102.....27724.....37300.....40066.....40318.....40320.....40320
...15872....85170....205134....308460....353556....362370....362878....362880
..101042...606542...1641534...2748354...3399246...3600306...3627778...3628798
..707584..4697946..14132390..26194542..35142546..38963958..39830282..39914754
.5405530.39330982.130299584.265691456.387129588.453658380.475089392.478739984

Examples

			Some solutions for n=8 k=4
..5....8....1....7....5....5....8....4....7....5....3....4....7....6....5....1
..8....1....7....3....1....4....1....7....2....4....5....2....2....5....3....2
..6....5....2....6....3....8....7....5....1....3....7....1....5....4....7....7
..7....6....6....8....6....6....6....1....5....8....2....7....1....7....6....4
..3....7....3....2....7....3....3....3....6....1....6....5....8....1....1....3
..4....3....8....1....4....7....2....8....4....7....4....8....3....8....2....6
..1....4....5....5....8....2....5....6....3....6....1....6....4....3....4....8
..2....2....4....4....2....1....4....2....8....2....8....3....6....2....8....5
		

Crossrefs

Column 1 is A001250.

A008971 Triangle read by rows: T(n,k) is the number of permutations of [n] with k increasing runs of length at least 2.

Original entry on oeis.org

1, 1, 1, 1, 1, 5, 1, 18, 5, 1, 58, 61, 1, 179, 479, 61, 1, 543, 3111, 1385, 1, 1636, 18270, 19028, 1385, 1, 4916, 101166, 206276, 50521, 1, 14757, 540242, 1949762, 1073517, 50521, 1, 44281, 2819266, 16889786, 17460701, 2702765, 1, 132854, 14494859
Offset: 0

Views

Author

Keywords

Comments

Row n has 1+floor(n/2) terms.
T(n,k) is also the number of permutations of [n] with k "exterior peaks" where we count peaks in the usual way, but add a peak at the beginning if the permutation begins with a descent, e.g. 213 has one exterior peak. T(3,1) = 5 since all permutations of [3] have an exterior peak except 123. This is also the definition for peaks of signed permutations, where we assume that a signed permutation always begins with a zero. - Kyle Petersen, Jan 14 2005
From Petros Hadjicostas, Aug 09 2019: (Start)
In their book, David and Barton (1962) use the notation T_{N,v*}^* for this array, where N is the length of the permutation and v* is the so-called "number of runs up" in the permutation. In modern terminology, a "run up" in a permutation is an increasing run of length >= 2. See their discussion on p. 154 of their book and see p. 163 for the definition of T_{N,v*}^*.
They do not consider as "runs up" single elements b_i in a permutation b = (b_1, b_2, ..., b_n) even if they satisfy b_{i-1} > b_i > b_{i+1} (with b_{n-1} > b_n when i = n and b_1 > b_2 when i = 1). (The command Runs[b] for permutation b in Mathematica, using the package Combinatorica`, will generate not only the "runs up" of b but also the single elements in the permutation b that satisfy one of the above inequalities. For example, Runs[{3,2,1}] gives the set of runs {{3}, {2}, {1}}, none of which is a "run up".)
So, here n = N and k = v*. On p. 163 of their book they give the recurrence shown below in the FORMULA section from Charalambides' (2002) book: T(n+1, k) = (2*k + 1) * T(n,k) + (n - 2*k + 2) * T(n, k-1) for n >= 0 and 1 <= k <= floor(n/2) + 1. The values of T_{N,v*}^* = T(n, k) appear in Table 10.5 (p. 163) of their book.
Since the complement of a permutation (b_1, b_2, ..., b_n) is (n+1-b_1, n+1-b_2, ..., n+1-b_n), it is clear that the current array T(n, k) is also the number of permutations of [n] with k decreasing runs of length >= 2 (i.e., the number of permutations of [n] with k "runs down" according to David and Barton (1962)).
Note that the number of permutations of [n] with k runs of length >= 2 that are either increasing or decreasing (i.e., the number of permutations of [n] that contain k "runs up" and "runs down" in total) is given by array A059427. One half of array A059427 is given in Table 10.4 (p. 159) in David and Barton (1962)--see also array A008970.
A run that is either a "run up" or "run down" (i.e., an ascending or a descending run of length >= 2) is called "séquence" by André (19th century) and Comtet (1974). See the references for sequence A000708 or for array A059427. (Again, recall that David and Barton do not consider single numbers as either a "run up" or a "run down".)
Morley (1897) proved that in a permutation of [n], #("runs up") + #("runs down") + #(monotonic triplets of adjacent numbers in the permutation) = n - 1. (His definition of a run is highly non-standard!) See the example below.
The number Q(n,k) of circular permutations of [n] that contain k runs that are either "runs up" or "runs down" (that is, k ascending or descending runs of length >= 2) is given by array A008303. More precisely, Q(n+1, 2*(k+1)) = A008303(n, k) for n >= 1 and 0 <= k <= ceiling(n/2)-1. In addition, 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.
The numbers in array A008303 appear in Table 10.6 (p. 163) in David and Barton (1962).
(End)

Examples

			Triangle T(n,k) (with rows n >= 0 and columns k >= 0) starts as follows:
  1;
  1;
  1,   1;
  1,   5;
  1,  18,       5;
  1,  58,      61;
  1, 179,     479,     61;
  1, 543,    3111,   1385;
  1, 1636,  18270,  19028,  1385;
  1, 4916, 101166, 206276, 50521;
  ...
Example: T(3,1) = 5 because all permutations of [3] with the exception of 321 have one increasing run of length at least 2.
From _Peter Bala_, Jan 23 2016: (Start)
Row 6: cos(x)^7*(d/dx)^6(1/cos(x)) = sin(x)^6 + 179*sin(x)^4 + 479*sin(x)^2 + 61.
Equivalently, (sqrt(1 - x^2))^7*D^6(1/sqrt(1 - x^2)) = x^6 + 179*x^4 + 479*x^2 + 61, where D = sqrt(1 - x^2)*d/dx. (End)
From _Petros Hadjicostas_, Aug 09 2019: (Start)
Consider the permutations of [4]. We list the increasing runs of length at least 2 (= "runs up"), the decreasing runs of length at least 2 (= "runs down"), and the monotonic triplets of adjacent numbers in the permutation (which we abbreviate to MTAN for simplicity). The sum of the numbers of these three should be n-1 (see Morley (1897) but notice that his use of the word "run" is highly non-standard).
1234 -> "runs up" = {1234}, "runs down" = {}, MTAN = {123, 234}.
1243 -> "runs up" = {124}, "runs down" = {43}, MTAN = {124}.
1324 -> "runs up" = {13, 24}, "runs down" = {32}, MTAN = {}.
1342 -> "runs up" = {134}, "runs down" = {42}, MTAN = {134}.
1423 -> "runs up" = {14, 23}, "runs down" = {42}, MTAN = {}.
1432 -> "runs up" = {14}, "runs down" = {432}, MTAN = {432}.
2134 -> "runs up" = {134}, "runs down" = {21}, MTAN = {134}.
2143 -> "runs up" = {14}, "runs down" = {21, 43}, MTAN = {}.
2314 -> "runs up" = {23, 14}, "runs down" = {31}, MTAN = {}.
2341 -> "runs up" = {234}, "runs down" = {41}, MTAN = {234}.
2413 -> "runs up" = {24, 13}, "runs down" = {41}, MTAN = {}.
2431 -> "runs up" = {24}, "runs down" = {431}, MTAN = {431}.
3124 -> "runs up" = {124}, "runs down" = {31}, MTAN = {124}.
3142 -> "runs up" = {14}, "runs down" = {31, 42}, MTAN = {}.
3214 -> "runs up" = {14}, "runs down" = {321}, MTAN = {321}.
3241 -> "runs up" = {24}, "runs down" = {32, 41}, MTAN = {}.
3412 -> "runs up" = {34, 12}, "runs down" = {41}, MTAN = {}.
3421 -> "runs up" = {34}, "runs down" = {421}, MTAN = {421}.
4123 -> "runs up" = {123}, "runs down" = {41}, MTAN = {123}.
4132 -> "runs up" = {13}, "runs down" = {41, 32}, MTAN = {}.
4213 -> "runs up" = {13}, "runs down" = {421}, MTAN = {421}.
4231 -> "runs up" = {23}, "runs down" = {42, 31}, MTAN = {}.
4312 -> "runs up" = {12}, "runs down" = {431}, MTAN = {431}.
4321 -> "runs up" = {}, "runs down" = {4321}, MTAN = {432, 321}.
If we let k = number of increasing runs of length >= 2 (= number of "runs up") in a permutation of [4], then (from above) the possible values of k are 0, 1, 2, and we have T(n=4, k=0) = 1, T(n=4, k=1) = 18, and T(n=4, k=2) = 5.
If we let k = number of decreasing runs of length >= 2 (= number of "runs down") in a permutation of [4], then again the possible values of k are 0, 1, 2, and we have T(n=4, k=0) = 1, T(n=4, k=1) = 18, and T(n=4, k=2) = 5.
Finally, note that if b_i, b_{i+1}, b_{i+2} is an increasing triplet of adjacent numbers in permutation b, then n+1-b_i, n+1-b_{i+1}, n+1-b_{i+2} is a decreasing triplet of adjacent numbers in the complement of b, and vice versa. For example, 4213 is the complement of 1342. Their set of monotonic triplets of adjacent numbers are {421} and {134}, respectively, and we have 4 + 1 = 2 + 3 = 1 + 4 = 5.
(End)
		

References

  • Ch. A. Charalambides, Enumerative Combinatorics, Chapman & Hall/CRC, Boca Raton, Florida, 2002.
  • F. N. David and D. E. Barton, Combinatorial Chance, Charles Griffin, 1962; see Table 10.5, p. 163.
  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 260.

Crossrefs

A160486 is a sub-triangle.
A000340, A000363, A000507 equal the second, third and fourth left hand columns.
T(2n,n) gives A000364.

Programs

  • Maple
    G:=sqrt(1-t)/(sqrt(1-t)*cosh(x*sqrt(1-t))-sinh(x*sqrt(1-t))): Gser:=simplify(series(G,x=0,15)): for n from 0 to 14 do P[n]:=sort(expand(n!*coeff(Gser,x,n))) od: seq(seq(coeff(t*P[n],t^k),k=1..1+floor(n/2)),n=0..14); # edited by Johannes W. Meijer, May 15 2009
    # second Maple program:
    T:= proc(n, k) option remember; `if`(k=0, 1, `if`(k>iquo(n, 2), 0,
          (2*k+1)*T(n-1, k) +(n+1-2*k)*T(n-1, k-1)))
        end:
    seq(seq(T(n, k), k=0..n/2), n=0..14); # Alois P. Heinz, Oct 16 2013
  • Mathematica
    t[n_, 0] = 1; t[n_, k_] /; k > Floor[n/2] = 0;
    t[n_ , k_ ] /; k <= Floor[n/2] := t[n, k] = (2 k + 1) t[n - 1, k] + (n - 2 k + 1) t[n - 1, k - 1];
    Flatten[Table[t[n, k], {n, 0, 12}, {k, 0, Floor[n/2]}]][[1 ;; 45]] (* Jean-François Alcover, May 30 2011, after given formula *)

Formula

E.g.f.: G(t,x) = sum(T(n,k) t^k x^n/n!, 0<=k<=floor(n/2), n>=0) = sqrt(1-t)/(sqrt(1-t)*cosh(x*sqrt(1-t))-sinh(x*sqrt(1-t))) (Ira M. Gessel).
T(n+1,k) = (2*k+1)*T(n,k) + (n-2*k+2)*T(n,k-1) (see p. 542 of the Charalambides reference or p. 163 in the David and Barton book).
G.f.: T(0)/(1-x), where T(k) = 1 - y*x^2*(k+1)^2/(y*x^2*(k+1)^2 - (1 -x -2*x*k)*(1 -3*x -2*x*k)/T(k+1) ); (continued fraction). - Sergei N. Gladkovskii, Nov 08 2013
From Peter Bala, Jan 23 2016: (Start)
cos(x)^(n+1)*(d/dx)^n(1/cos(x)) = Sum_{k = 0..floor(n/2)} T(n,k)*sin(x)^(n-2*k).
Equivalently, let D be the differential operator sqrt(1 - x^2)*d/dx. Then sqrt(1 - x^2)^(n+1)*D^n(1/sqrt(1 - x^2)) = Sum_{k = 0..floor(n/2)} T(n,k)*x^(n-2*k). (End)

Extensions

Edited by Emeric Deutsch and Ira M. Gessel, Aug 28 2004
Crossrefs added by Johannes W. Meijer, May 24 2009

A001758 Number of quasi-alternating permutations of length n.

Original entry on oeis.org

0, 2, 12, 58, 300, 1682, 10332, 69298, 505500, 3990362, 33925452, 309248938, 3010070700, 31167995042, 342164637372, 3970297978978, 48558251523900, 624386836023722, 8421511353298092, 118891756573779418, 1753452275441153100, 26967372781086764402
Offset: 2

Views

Author

Keywords

Comments

The number of permutations of [n] with n-2 sequences (see Comtet).
From Petros Hadjicostas, Aug 08 2019: (Start)
We clarify the word "sequences" used above because it may not be standard. On pp. 260-261 of his book, Comtet (1974) defines a so-called "sequence" in a permutation b of [n]. Using one-line notation (not cycle notation), write b = (b_1, b_2, ..., b_n) for the elements of a permutation of [n]. A maximal list of indices of length l (where l >= 2) is called a "sequence" in the permutation b if it is of the form {i, i+1, ..., i+l-1} for some integer i (with 1 <= i <= n-l+1) such that b_i < b_{i+1} < ... < b_{i+l-1} or b_i > b_{i+1} > ... > b_{i+l-1}. (The word "maximal" means that in the first case, b_{i-1} > b_i and b_{i+l} < b_{i+l-1}, while in the second case, b_{i-1} < b_i and b_{i+l} > b_{i+l-1}, provided that b_{i-1} and b_{i+l} can be defined.) The assumption l >= 2 is important; i.e., these so-called "sequences" should have length >= 2.
Comtet (1974) has borrowed this confusing terminology about "séquences" in permutations from André (see links to some of his papers below). André actually uses the term "séquence" for the list of terms (b_i, b_{i+1}, ..., b_{i+l-1}) rather than the index set {i, i+1, ..., i+l-1}.
Some authors today use the term "alternate runs" (or just "runs") to discuss these so-called "séquences" defined by Comtet and André but we must have l >= 2.
Thus, here a(n) is the number of permutations of [n] with n-2 such "séquences" ("alternate runs").
For an extensive discussion of these so-called "séquences" in permutations ("alternate runs"), maxima and minima in a permutation, alternate and quasi-alternate permutations, and other related information, see the four papers by André, or see my comments for sequence A000708 (which equals one-half of the current sequence).
David and Barton (1962, p. 154) call these "séquences" "runs up" if they are ascending and "runs down" if they are descending. In modern terminology, "runs up" are ascending runs of length >= 2 while "runs down" are descending runs of length >= 2. Thus, a modern terminology for these "séquences" is "ascending or descending runs of length >= 2".
(End)

Examples

			G.f. = 2*x^3 + 12*x^4 + 58*x^5 + 300*x^6 + 1682*x^7 + 10332*x^8 + 69298*x^9 + ...
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 261.
  • F. N. David and D. E. Barton, Combinatorial Chance, Charles Griffin, 1962.
  • E. Netto, Lehrbuch der Combinatorik. 2nd ed., Teubner, Leipzig, 1927, p. 113.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Essentially the same as 2*A000708.
The diagonal P(n, n-2) of A059427.
See A008970 for formulas.

Programs

  • Maple
    seq(i!*coeff(series((tan(t)+sec(t))^2-4*(tan(t)+sec(t)),t,35),t,i),i=2..24); # Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Mar 12 2001
  • Mathematica
    With[{nn=30}, Join[{1}, Drop[CoefficientList[Series[(Tan[x]+Sec[x])^2- 4(Tan[x]+Sec[x]),{x,0,nn}],x] Range[0,nn]!,3]]] (* Harvey P. Dale, Oct 01 2011 *)
    a[ n_] := If[ n < 0, 0, n! SeriesCoefficient[ (u (u - 4) /. u -> Tan[x] + Sec[x]) + 3 + 2 x, {x, 0, n}]]; (* Michael Somos, Oct 24 2015 *)
    Table[4 Abs[PolyLog[-n-1, I]] - 8 Abs[PolyLog[-n, I]], {n, 2, 23}] (* Jean-François Alcover, Jul 01 2017 *)
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); 2 * n! * polcoeff( 1 + x + (1 - 2 * cos(x + A)) / (1 - sin(x + A)), n))}; /* Michael Somos, Aug 28 2012 */
    
  • PARI
    x='x+O('x^99); concat(0, Vec(serlaplace(2*(1+x+(1-2*cos(x))/(1-sin(x)))))) \\ Altug Alkan, Jul 01 2017

Formula

E.g.f.: 3 + 2*x + u(x)^2 - 4*u(x) where u(x) = tan(x) + sec(x). - Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Mar 12 2001
E.g.f.: 2 * (1 + x + (1 - 2*cos(x)) / (1 - sin(x))). - Michael Somos, Aug 28 2012
Asymptotics: a(n) ~ 8*(2/Pi)^(n+1)*((n+1)/Pi-1)*n!.
a(n) = A001250(n+1) - 2*A001250(n). - Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Mar 12 2001

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Feb 01 2001
Edited by N. J. A. Sloane, Aug 27 2012

A060158 Number of permutations of [n] with 4 sequences.

Original entry on oeis.org

0, 0, 0, 0, 0, 32, 300, 1852, 9576, 45096, 201060, 866324, 3650592, 15154240, 62260380, 253939116, 1030367448, 4165106264, 16790875860, 67553807428, 271383782544, 1089035545968, 4366631897100, 17497971562460, 70086163646280, 280627369334152, 1123357369925700
Offset: 0

Views

Author

Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Mar 12 2001

Keywords

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 261.

Crossrefs

Programs

  • Maple
    n4 := n->2*n-7+(6-n)*2^(n-1)-3^n+4^(n-1); seq(n4(i),i=5..27);
  • Mathematica
    Join[{0, 0}, LinearRecurrence[{13, -67, 175, -244, 172, -48}, {0, 0, 0, 32, 300, 1852}, 25]] (* Jean-François Alcover, Sep 02 2018 *)
  • PARI
    a(n) = { if (n<2, 0, 2*n - 7 + (6 - n)*2^(n - 1) - 3^n + 4^(n - 1)) } \\ Harry J. Smith, Jul 02 2009

Formula

a(n) = 2n - 7 + (6-n)*2^(n-1) - 3^n + 4^(n-1).
G.f.: 4*x^5*(8-29*x+24*x^2)/((1-4*x)*(1-3*x)*(1-2*x)^2*(1-x)^2).

Extensions

Edited by N. J. A. Sloane, Nov 11 2006

A360426 Number of permutations of [2n] having exactly n alternating up/down runs where the first run is not a down run.

Original entry on oeis.org

1, 1, 6, 118, 4788, 325446, 33264396, 4766383420, 911323052520, 224136553339270, 68929638550210620, 25914939202996628148, 11693626371194331008088, 6236691723226152102621084, 3881046492003600271067466744, 2786922888404654795314066258488, 2287283298159853722760705106305488
Offset: 0

Views

Author

Alois P. Heinz, Feb 08 2023

Keywords

Comments

Number of permutations of [2n] such that the differences have n runs with the same signs where the first run does not have negative signs.

Examples

			a(0) = 1: (), the empty permutation.
a(1) = 1: 12.
a(2) = 6: 1243, 1342, 1432, 2341, 2431, 3421.
a(3) = 118: 123546, 123645, 124356, ..., 564123, 564213, 564312.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(n<2, 0, `if`(k=1, 1,
          k*b(n-1, k) + 2*b(n-1, k-1) + (n-k)*b(n-1, k-2)))
        end:
    a:= n-> `if`(n=0, 1, b(2*n, n)):
    seq(a(n), n=0..17);

Formula

a(n) = A008970(2n,n) = (1/2) * A059427(2n,n) for n>=1.
a(n) ~ c * d^n * n!^2 / n, where d = 3.421054620671187024940215794079585351303138828348... (same as for A291677 and A303159) and c = 0.23613698601500409294656476488227001191406... - Vaclav Kotesovec, Feb 18 2023

A123003 Expansion of g.f.: (8-29*x+24*x^2)/((1-4*x)*(1-3*x)*(1-2*x)^2*(1-x)^2).

Original entry on oeis.org

8, 75, 463, 2394, 11274, 50265, 216581, 912648, 3788560, 15565095, 63484779, 257591862, 1041276566, 4197718965, 16888451857, 67845945636, 272258886492, 1091657974275, 4374492890615, 17521540911570, 70156842333538, 280839342481425, 1123993155149853
Offset: 0

Views

Author

N. J. A. Sloane, Nov 09 2006

Keywords

Crossrefs

Programs

  • Magma
    [(2*n + 3 - (n-1)*2^(n+4) - 3^(n+5) + 4^(n+4))/4: n in [0..30]];  // G. C. Greubel, Jul 12 2021
    
  • Mathematica
    LinearRecurrence[{13, -67, 175, -244, 172, -48}, {8, 75, 463, 2394, 11274, 50265}, 23] (* Jean-François Alcover, Oct 08 2018 *)
  • Sage
    [(2*n + 3 - (n-1)*2^(n+4) - 3^(n+5) + 4^(n+4))/4 for n in [0..30]] # G. C. Greubel, Jul 12 2021

Formula

a(n) = (2*(n+1) + 1 - 16*(n-1)*2^n - 243*3^n + 64*4^(n+1))/4. - Greg Dresden, Jun 21 2021
Showing 1-10 of 11 results. Next