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

A001883 Number of permutations s of {1,2,...,n} such that |s(i)-i|>1 for each i=1,2,...,n.

Original entry on oeis.org

1, 0, 0, 0, 1, 4, 29, 206, 1708, 15702, 159737, 1780696, 21599745, 283294740, 3995630216, 60312696452, 970234088153, 16571597074140, 299518677455165, 5711583170669554, 114601867572247060, 2413623459384988298, 53238503492701261201, 1227382998752177970288, 29520591675204638641249
Offset: 0

Views

Author

Keywords

Comments

Permanent of the (0,1)-matrix having (i,j)-th entry equal to 0 iff this is on the first lower-diagonal, diagonal or the first upper-diagonal. - Simone Severini, Oct 14 2004

References

  • J. Riordan, "The enumeration of permutations with three-ply staircase restrictions," unpublished memorandum, Bell Telephone Laboratories, Murray Hill, NJ, Oct 1963.
  • 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

Also a diagonal of A080018.
Column k=0 of A323671.

Programs

  • Maple
    b:= proc(n, s) option remember; `if`(n=0, 1, add(
          `if`(abs(n-i)<=1, 0, b(n-1, s minus {i})), i=s))
        end:
    a:= n-> b(n, {$1..n}):
    seq(a(n), n=0..15);  # Alois P. Heinz, Jul 04 2015
  • Mathematica
    b[n_, s_List] := b[n, s] = If[n == 0, 1, Sum[If[Abs[n-i] <= 1, 0, b[n-1, s ~Complement~ {i}]], {i, s}]]; a[n_] := b[n, Range[n]]; Table[Print[a[n]]; a[n], {n, 4, 24}] (* Jean-François Alcover, Nov 10 2015, after Alois P. Heinz *)
  • PARI
    permRWNb(a)=n=matsize(a)[1]; if(n==1,return(a[1,1])); sg=1; in=vectorv(n); x=in; x=a[,n]-sum(j=1,n,a[,j])/2; p=prod(i=1,n,x[i]); for(k=1,2^(n-1)-1,sg=-sg; j=valuation(k,2)+1; z=1-2*in[j]; in[j]+=z; x+=z*a[,j]; p+=prod(i=1,n,x[i],sg)); return(2*(2*(n%2)-1)*p)
    for(n=1,23,a=matrix(n,n,i,j,abs(i-j)>1);print1(permRWNb(a)",")) \\ Herman Jamke (hermanjamke(AT)fastmail.fm), May 16 2007

Formula

a(n) = (n+1)*a(n-1) - (n-3)*a(n-2) - (n-4)*a(n-3) + (n-4)*a(n-4) + a(n-5) + (-1)^n * Lucas(n-3), n > 4. [Riordan] (Note: There is a slight mistake in Riordan's paper. On p. 3 it should say that a_5 = 3.) - Eric M. Schmidt, Oct 09 2017
From Vaclav Kotesovec, Oct 10 2017: (Start)
a(n) = n*a(n-1) + 4*a(n-2) - 3*(n-3)*a(n-3) + (n-4)*a(n-4) + 2*(n-5)*a(n-5) - (n-7)*a(n-6) - a(n-7).
a(n) ~ exp(-3) * n!.
(End)

Extensions

More terms and better description from Reiner Martin, Oct 14 2002
More terms from Vladimir Baltic, Vladeta Jovovic, Jan 04 2003
More terms from Herman Jamke (hermanjamke(AT)fastmail.fm), May 16 2007
a(22)-a(24) from Alois P. Heinz, Jul 04 2015
a(0)-a(3) from Eric M. Schmidt, Oct 09 2017

A075851 Number of permutations s of {1,2,...,n} such that |s(i)-i|>2 for each i=1,2,...,n.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 1, 8, 112, 1168, 13365, 159414, 2036488, 27780408, 404351752, 6263006598, 102946702825, 1790795492176, 32880327473840, 635630231970048, 12907624693811937, 274744151265431700, 6117666413618771968, 142238172767973342656
Offset: 0

Views

Author

Reiner Martin, Oct 15 2002

Keywords

Comments

a(n) equals the permanent of the n X n matrix with 0's along the main diagonal, the superdiagonal, the subdiagonal, the sub-subdiagonal, the super-superdiagonal, and 1's everywhere else. - John M. Campbell, Jul 09 2011

Crossrefs

Programs

  • Maple
    b:= proc(s) option remember; (n-> `if`(n=0, 1, add(
          `if`(abs(n-i)>2, b(s minus {i}), 0), i=s)))(nops(s))
        end:
    a:= n-> b({$1..n}):
    seq(a(n), n=0..15);  # Alois P. Heinz, Jan 25 2019
  • Mathematica
    a[0] = 1; a[n_] := a[n] = If[n<6, 0, SparseArray[{Band[{1, 1}] -> 0, Band[{2, 1}] -> 0, Band[{3, 1}] -> 0, Band[{1, 2}] -> 0, Band[{1, 3}] -> 0}, {n, n}, 1] // Permanent];
    Table[Print[n, " ", a[n]]; a[n], {n, 0, 23}] (* Jean-François Alcover, Apr 30 2019 *)

Extensions

More terms from Vladimir Baltic, Vladeta Jovovic, Jan 04 2003
a(21) from Alois P. Heinz, Jul 04 2015
a(22)-a(23) from Alois P. Heinz, Jan 22 2019
a(0)=1 prepended by Alois P. Heinz, Jan 25 2019

A183244 T(n,k) = Number of permutations of 1..n+2*k-1 with each element displaced by at least k.

Original entry on oeis.org

1, 1, 2, 1, 4, 9, 1, 8, 29, 44, 1, 16, 112, 206, 265, 1, 32, 436, 1168, 1708, 1854, 1, 64, 1708, 6984, 13365, 15702, 14833, 1, 128, 6724, 41808, 114124, 159414, 159737, 133496, 1, 256, 26572, 250464, 998112, 1799688, 2036488, 1780696, 1334961, 1, 512
Offset: 1

Views

Author

R. H. Hardin, Jan 03 2011

Keywords

Comments

Table starts
........1.........1..........1............1.............1...............1
........2.........4..........8...........16............32..............64
........9........29........112..........436..........1708............6724
.......44.......206.......1168.........6984.........41808..........250464
......265......1708......13365.......114124........998112.........8751552
.....1854.....15702.....159414......1799688......21201024.......252813312
....14833....159737....2036488.....29125117.....441629332......6860776320
...133496...1780696...27780408....486980182....9154333160....178195229760
..1334961..21599745..404351752...8490078104..192565379941...4564491262444
.14684570.283294740.6263006598.154750897552.4146526612518.116967725946488

Examples

			All permutations of 1-5 with minimum displacement 2:
(3,4,5,1,2) (3,4,5,2,1) (4,5,1,2,3) (5,4,1,2,3).
		

Crossrefs

Column 1 is A000166(n+1).
Column 2 is A001883(n+3).
Column 3 is A075851(n+5).
Column 4 is A075852(n+7).

Programs

  • Mathematica
    T[n_, k_] := Permanent[nrows = n+2k-1; Table[If[Abs[i-j] <= k-1, 0, 1], {i, 1, nrows}, {j, 1, nrows}]]; Table[t = T[n-k+1, k]; Print[ "T(", n-k+1, ",", k, ") = ", t]; t, {n, 1, 9}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Jan 07 2016, adapted from Sage *)
  • Sage
    def A183244_T(n,k):
        return Matrix(lambda i,j: 0 if abs(i-j) <= (k-1) else 1, nrows=n+2*k-1).permanent() # D. S. McNeil, Jan 04 2011

A299789 Number T(n,k) of permutations p of [n] such that min_{j=1..n} |p(j)-j| = k; triangle T(n,k), n >= 0, 0 <= k <= floor(n/2), read by rows.

Original entry on oeis.org

0, 1, 1, 1, 4, 2, 15, 8, 1, 76, 40, 4, 455, 236, 28, 1, 3186, 1648, 198, 8, 25487, 13125, 1596, 111, 1, 229384, 117794, 14534, 1152, 16, 2293839, 1175224, 146372, 12929, 435, 1, 25232230, 12903874, 1621282, 152430, 6952, 32, 302786759, 154615096, 19563257, 1922364, 112416, 1707, 1
Offset: 0

Views

Author

Alois P. Heinz, Jan 21 2019

Keywords

Examples

			T(4,0) = 15: 1234, 1243, 1324, 1342, 1423, 1432, 2134, 2314, 2431, 3124, 3214, 3241, 4132, 4213, 4231.
T(4,1) = 8: 2143, 2341, 2413, 3142, 3421, 4123, 4312, 4321.
T(4,2) = 1: 3412.
T(5,2) = 4: 34512, 34521, 45123, 54123.
T(6,3) = 1: 456123.
T(7,3) = 8: 4567123, 4567132, 4567213, 4567231, 5671234, 5761234, 6571234, 7561234.
T(8,4) = 1: 56781234.
T(9,4) = 16: 567891234, 567891243, 567891324, 567891342, 567892134, 567892143, 567892314, 567892341, 678912345, 679812345, 687912345, 697812345, 768912345, 769812345, 867912345, 967812345.
Triangle T(n,k) begins:
          0;
          1;
          1,         1;
          4,         2;
         15,         8,        1;
         76,        40,        4;
        455,       236,       28,       1;
       3186,      1648,      198,       8;
      25487,     13125,     1596,     111,      1;
     229384,    117794,    14534,    1152,     16;
    2293839,   1175224,   146372,   12929,    435,    1;
   25232230,  12903874,  1621282,  152430,   6952,   32;
  302786759, 154615096, 19563257, 1922364, 112416, 1707, 1;
  ...
		

Crossrefs

Columns k=0-1 give: A002467, A296050.
Row sums give A000142 (for n>0).
T(2n,n) gives A057427.
T(2n+1,n) gives A000079.
T(2n+2,n) gives A306545.

Programs

  • Maple
    b:= proc(s) option remember; (n-> `if`(n=1, x^(s[1]-1),
          add((p-> add(coeff(p, x, i)*x^min(i, abs(n-j)),
          i=0..degree(p)))(b(s minus {j})), j=s)))(nops(s))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..max(0, degree(p))))(b({$1..n})):
    seq(T(n), n=0..14);
    # second Maple program:
    A:= proc(n, k) option remember; `if`(n=0, 0, LinearAlgebra[
          Permanent](Matrix(n, (i, j)-> `if`(abs(i-j)>=k, 1, 0))))
        end:
    T:= (n, k)-> A(n, k)-A(n, k+1):
    seq(seq(T(n, k), k=0..n/2), n=0..14);
  • Mathematica
    A[n_, k_] := A[n, k] = If[n==0, 0, Permanent[Table[If[Abs[i-j] >= k, 1, 0], {i, 1, n}, {j, 1, n}]]];
    T[n_, k_] := A[n, k] - A[n, k+1];
    Table[T[n, k], {n, 0, 14}, {k, 0, n/2}] // Flatten (* Jean-François Alcover, May 01 2019, from 2nd Maple program *)

Formula

T(n,k) = A306543(n,k) - A306543(n,k+1) for n > 0.
Sum_{k=1..floor(n/2)} k * T(n,k) = A129118(n).
Sum_{k=1..floor(n/2)} T(n,k) = A000166(n).
Sum_{k=2..floor(n/2)} T(n,k) = A001883(n).
Sum_{k=3..floor(n/2)} T(n,k) = A075851(n).
Sum_{k=4..floor(n/2)} T(n,k) = A075852(n).

A001887 Number of permutations p of {1,2,...,n} such that p(i) - i < 0 or p(i) - i > 2 for all i.

Original entry on oeis.org

1, 0, 0, 0, 1, 5, 33, 236, 1918, 17440, 175649, 1942171, 23396353, 305055960, 4280721564, 64330087888, 1030831875953, 17545848553729, 316150872317105, 6012076099604308, 120330082937778554
Offset: 0

Views

Author

Keywords

Comments

Previous name was: Hit polynomials.

References

  • J. Riordan, The enumeration of permutations with three-ply staircase restrictions, unpublished memorandum, Bell Telephone Laboratories, Murray Hill, NJ, Oct 1963. (See A001883)
  • 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

Programs

  • Mathematica
    nmax = 21;
    gf = 1/(x^2-1)(x-Sum[n! (x(x-1)/(x^3-2x-1))^n + O[x]^nmax, {n, 0, nmax}]);
    CoefficientList[gf, x] (* Jean-François Alcover, Aug 19 2018 *)

Formula

G.f.: (1/(x^2-1))*(x-Sum_{n>=0} n!*(x*(x-1)/(x^3-2*x-1))^n). - Vladeta Jovovic, Jun 30 2007
D-finite with recurrence (P. Flajolet, 1997): a(n) = (n-1)*a(n-1) + (n+2)*a(n-2) - (3*n-13)*a(n-3) - (2*n-8)*a(n-4) + (3*n-15)*a(n-5) + (n-4)*a(n-6) - (n-7)*a(n-7) - a(n-8), n>8.
a(n) ~ exp(-3) * n!. - Vaclav Kotesovec, Sep 10 2014

Extensions

More terms from Vladimir Baltic and Vladeta Jovovic, Jan 05 2003
New name from Vaclav Kotesovec using a former comment by Vladimir Baltic and Vladeta Jovovic, Sep 16 2014

A078509 Number of permutations p of {1,2,...,n} such that p(i)-i != 1 and p(i)-i != 2 for all i.

Original entry on oeis.org

1, 1, 1, 1, 5, 23, 131, 883, 6859, 60301, 591605, 6405317, 75843233, 974763571, 13512607303, 200949508327, 3190881283415, 53880906258521, 964039575154409, 18217997734199113, 362584510633666621, 7580578211464070863, 166099466140519353035, 3806162403831340850651
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<4, 1,
          (n-1)*a(n-1) +(n-3)*a(n-2) +a(n-3))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Jan 10 2014
  • Mathematica
    a = DifferenceRoot[Function[{y, n}, {-y[n] - n y[n+1] - (n+2) y[n+2] + y[n+3] == 0, y[0] == 1, y[1] == 1, y[2] == 1, y[3] == 1}]];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Dec 20 2020, after Alois P. Heinz *)

Formula

From Vladeta Jovovic, Jul 16 2007: (Start)
G.f.: x/(1+x)*Sum_{n>=0} (n+1)!*(x/(1+x)^2)^n.
a(n) = Sum_{k=1..n} (-1)^(n-k)*k!*binomial(n+k-2,2*k-2). (End)
a(n) ~ exp(-2) * n!. - Vaclav Kotesovec, Aug 25 2014

Extensions

More terms from Alois P. Heinz, Jan 10 2014

A306543 Number T(n,k) of permutations p of [n] such that |p(j)-j| >= k (for all j in [n]); triangle T(n,k), n >= 0, 0 <= k <= floor(n/2), read by rows.

Original entry on oeis.org

1, 1, 2, 1, 6, 2, 24, 9, 1, 120, 44, 4, 720, 265, 29, 1, 5040, 1854, 206, 8, 40320, 14833, 1708, 112, 1, 362880, 133496, 15702, 1168, 16, 3628800, 1334961, 159737, 13365, 436, 1, 39916800, 14684570, 1780696, 159414, 6984, 32, 479001600, 176214841, 21599745, 2036488, 114124, 1708, 1
Offset: 0

Views

Author

Alois P. Heinz, Feb 22 2019

Keywords

Examples

			Triangle T(n,k) begins:
          1;
          1;
          2,         1;
          6,         2;
         24,         9,        1;
        120,        44,        4;
        720,       265,       29,       1;
       5040,      1854,      206,       8;
      40320,     14833,     1708,     112,      1;
     362880,    133496,    15702,    1168,     16;
    3628800,   1334961,   159737,   13365,    436,    1;
   39916800,  14684570,  1780696,  159414,   6984,   32;
  479001600, 176214841, 21599745, 2036488, 114124, 1708, 1;
  ...
		

Crossrefs

Columns k=0-6 give (offsets may differ): A000142, A000166, A001883, A075851, A075852, A183242, A183243.
T(2n,n) gives A000012.
T(2n+1,n) gives A000079.
T(2n+2,n) gives A183245 for n > 0.
T(2n+3,n) gives A183246 for n > 0.
T(2n+4,n) gives A183247 for n > 0.

Programs

  • Maple
    T:= proc(n, k) option remember; `if`(n=0, 1, LinearAlgebra[
          Permanent](Matrix(n, (i, j)-> `if`(abs(i-j)>=k, 1, 0))))
        end:
    seq(seq(T(n, k), k=0..floor(n/2)), n=0..12);
  • Mathematica
    T[n_, k_] := T[n, k] = If[n==0, 1, Permanent[Table[
         If[Abs[i-j] >= k, 1, 0], {i, n}, {j, n}]]];
    Table[Table[T[n, k], {k, 0, Floor[n/2]}], {n, 0, 12}] // Flatten (* Jean-François Alcover, Mar 26 2021, after Alois P. Heinz *)

Formula

T(n,k) = Sum_{j=k..floor(n/2)} A299789(n,j) for n > 0.
Showing 1-7 of 7 results.