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

A002524 Number of permutations of length n within distance 2 of a fixed permutation.

Original entry on oeis.org

1, 1, 2, 6, 14, 31, 73, 172, 400, 932, 2177, 5081, 11854, 27662, 64554, 150639, 351521, 820296, 1914208, 4466904, 10423761, 24324417, 56762346, 132458006, 309097942, 721296815, 1683185225, 3927803988, 9165743600, 21388759708, 49911830577, 116471963129
Offset: 0

Views

Author

Keywords

Comments

From Torleiv Kløve, Jan 09 2009: (Start)
Let V(d,n) be the number of permutations of length n within distance d of a fixed permutation. For d=1,2,3,4,...,10 these are A000045, A002524, A002526, A072856, A154654, A154655, A154656, A154657, A154658, A154659. The generating function is a rational function f_d(z)/g_d(z) (see the Kløve report referenced here). For d<=6, deg g_d = 2^{d-1} + binomial(2*d,d)/2 and deg f_d(z) = deg g_d(z)-2d. As a table:
d deg g_d deg f_d
1 2 0
2 5 1
3 14 8
4 43 35
5 142 132
6 494 482
(End)
For positive n, a(n) equals the permanent of the n X n matrix with 1's along the five central diagonals, and 0's everywhere else. - John M. Campbell, Jul 09 2011

References

  • D. H. Lehmer, Permutations with strongly restricted displacements. Combinatorial theory and its applications, II (Proc. Colloq., Balatonfured, 1969), pp. 755-770. North-Holland, Amsterdam, 1970.
  • 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).
  • R. P. Stanley, Enumerative Combinatorics I, Example 4.7.16, p. 253.

Crossrefs

Column k=2 of A306209.

Programs

  • Magma
    I:=[1,1,2,6,14]; [n le 5 select I[n] else 2*Self(n-1) +2*Self(n-3) -Self(n-5): n in [1..41]]; // G. C. Greubel, Jan 21 2022
    
  • Mathematica
    CoefficientList[Series[(1-x)/(1-2*x-2*x^3+x^5), {x,0,50}], x] (* Vladimir Joseph Stephan Orlovsky, Jun 24 2011 *)
  • PARI
    a(n)=if(n,([0,1,0,0,0; 0,0,1,0,0; 0,0,0,1,0; 0,0,0,0,1; -1,0,2,0,2]^n*[1;1;2;6;14])[1,1],1) \\ Charles R Greathouse IV, Jul 28 2015
    
  • Sage
    [( (1-x)/(1-2*x-2*x^3+x^5) ).series(x,n+1).list()[n] for n in (0..40)] # G. C. Greubel, Jan 21 2022

Formula

G.f.: (1-x)/(1-2*x-2*x^3+x^5). - Simon Plouffe in his 1992 dissertation.

Extensions

Typo in comment corrected by Vaclav Kotesovec, Dec 01 2012

A306209 Number A(n,k) of permutations of [n] within distance k of a fixed permutation; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 1, 2, 6, 5, 1, 1, 1, 2, 6, 14, 8, 1, 1, 1, 2, 6, 24, 31, 13, 1, 1, 1, 2, 6, 24, 78, 73, 21, 1, 1, 1, 2, 6, 24, 120, 230, 172, 34, 1, 1, 1, 2, 6, 24, 120, 504, 675, 400, 55, 1, 1, 1, 2, 6, 24, 120, 720, 1902, 2069, 932, 89, 1, 1, 1, 2, 6, 24, 120, 720, 3720, 6902, 6404, 2177, 144, 1
Offset: 0

Views

Author

Alois P. Heinz, Jan 29 2019

Keywords

Comments

A(n,k) counts permutations p of [n] such that |p(j)-j| <= k for all j in [n].

Examples

			A(4,1) = 5: 1234, 1243, 1324, 2134, 2143.
A(5,2) = 31: 12345, 12354, 12435, 12453, 12534, 12543, 13245, 13254, 13425, 13524, 14235, 14253, 14325, 14523, 21345, 21354, 21435, 21453, 21534, 21543, 23145, 23154, 24135, 24153, 31245, 31254, 31425, 31524, 32145, 32154, 34125.
Square array A(n,k) begins:
  1,  1,   1,    1,    1,     1,     1,     1,     1, ...
  1,  1,   1,    1,    1,     1,     1,     1,     1, ...
  1,  2,   2,    2,    2,     2,     2,     2,     2, ...
  1,  3,   6,    6,    6,     6,     6,     6,     6, ...
  1,  5,  14,   24,   24,    24,    24,    24,    24, ...
  1,  8,  31,   78,  120,   120,   120,   120,   120, ...
  1, 13,  73,  230,  504,   720,   720,   720,   720, ...
  1, 21, 172,  675, 1902,  3720,  5040,  5040,  5040, ...
  1, 34, 400, 2069, 6902, 17304, 30960, 40320, 40320, ...
		

Crossrefs

Rows n=1-2 give: A000012, A040000.
Main diagonal gives A000142.
A(2n,n) gives A048163(n+1).
A(2n+1,n) gives A092552(n+1).
A(n,floor(n/2)) gives A306267.
A(n+2,n) gives A001564.
Cf. A130152.

Programs

  • Mathematica
    A[0, _] = 1;
    A[n_ /; n > 0, k_] := A[n, k] = Permanent[Table[If[Abs[i - j] <= k, 1, 0], {i, 1, n}, {j, 1, n}]];
    Table[A[n - k, k], {n, 0, 12}, {k, n, 0, -1 }] // Flatten (* Jean-François Alcover, Oct 18 2021, after Alois P. Heinz in A130152 *)

Formula

A(n,k) = Sum_{j=0..k} A130152(n,j) for n > 0, A(0,k) = 1.

A154655 Number of permutations of length n within distance 6.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 720, 5040, 30960, 172200, 899064, 4553166, 22934774, 116914351, 610093513, 3222826972, 17101449940, 90706002192, 479654768640, 2527274267136, 13280313508416, 69734129749632, 366283822765632, 1925290900630896, 10126754515065868
Offset: 0

Views

Author

Torleiv Kløve, Jan 13 2009

Keywords

Comments

a(n) equals the permanent of the n X n matrix with 1's along the central thirteen diagonals, and 0's everywhere else. - John M. Campbell, Jul 10 2011

Crossrefs

Column k=6 of A306209.

Formula

G.f. is a rational function f(x)/g(x) where f has degree 482 and g has degree 494.

Extensions

a(0)=1 prepended by Alois P. Heinz, Jan 28 2019

A154656 Number of permutations of length n within distance 7.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 720, 5040, 40320, 287280, 1865520, 11345160, 66349464, 381523758, 2193664790, 12764590275, 75796724309, 455383613924, 2750869551868, 16635586999056, 100439873614656, 604666567043712, 3629299734118656, 21736009354060800, 130082373922081536
Offset: 0

Views

Author

Torleiv Kløve, Jan 13 2009

Keywords

Comments

a(n) equals the permanent of the n X n matrix with 1's along the central fifteen diagonals, and 0's everywhere else. - John M. Campbell, Jul 10 2011

Crossrefs

Column k=7 of A306209.

Extensions

a(0)=1 prepended by Alois P. Heinz, Jan 28 2019

A154657 Number of permutations of length n within distance 8.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 2943360, 21898800, 152622000, 1017952680, 6623303544, 42700751022, 276054834902, 1805409270031, 12020754177001, 80930279045116, 548117873866228, 3720269813727312, 25239622338694272, 170893063638209664
Offset: 0

Views

Author

Torleiv Kløve, Jan 13 2009

Keywords

Comments

a(n) equals the permanent of the n X n matrix with 1's along the central seventeen diagonals, and 0's everywhere else. - John M. Campbell, Jul 10 2011

Crossrefs

Extensions

a(0)=1 prepended by Alois P. Heinz, Jan 28 2019

A154658 Number of permutations of length n within distance 9.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 33022080, 277280640, 2184341040, 16427628720, 119892387720, 861175365144, 6157828055310, 44222780245622, 321113303226243, 2369364111428885, 17667206334000068, 132553643382927196, 997400200347756816
Offset: 0

Views

Author

Torleiv Kløve, Jan 13 2009

Keywords

Comments

a(n) equals the permanent of the n X n matrix with 1's along the central nineteen diagonals, and 0's everywhere else. - John M. Campbell, Jul 10 2011

Crossrefs

Extensions

a(0)=1 prepended by Alois P. Heinz, Jan 28 2019

A154659 Number of permutations of length n within distance 10.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 402796800, 3770686080, 33187593600, 278598101040, 2261952938160, 17986137205800, 141564484858104, 1112444773251726, 8787513806478134, 70146437009397871, 568128719132038153, 4647312969412825372
Offset: 0

Views

Author

Torleiv Kløve, Jan 13 2009

Keywords

Crossrefs

Extensions

More terms from Alois P. Heinz, Jan 13 2014

A376743 Number of permutations (p(1),p(2),...,p(n)) of (1,2,...,n) such that p(i)-i is in {-2,-1,4} for all i=1,...,n.

Original entry on oeis.org

1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 5, 5, 6, 8, 11, 15, 25, 35, 46, 61, 85, 125, 175, 245, 341, 470, 650, 925, 1300, 1810, 2521, 3520, 4915, 6880, 9640, 13476, 18801, 26251, 36721, 51346, 71776, 100335, 140210, 195886, 273813, 382821, 535105, 747850, 1045220
Offset: 0

Views

Author

Michael A. Allen, Oct 03 2024

Keywords

Comments

Other sequences related to strongly restricted permutations pi(i) of i in {1,..,n} along with the sets of allowed p(i)-i (containing at least 3 elements): A000045 {-1,0,1}, A189593 {-1,0,2,3,4,5,6}, A189600 {-1,0,2,3,4,5,6,7}, A006498 {-2,0,2}, A080013 {-2,1,2}, A080014 {-2,0,1,2}, A033305 {-2,-1,1,2}, A002524 {-2,-1,0,1,2}, A080000 {-2,0,3}, A080001 {-2,1,3}, A080004 {-2,0,1,3}, A080002 {-2,2,3}, A080005 {-2,0,2,3}, A080008 {-2,1,2,3}, A080011 {-2,0,1,2,3}, A079999 {-2,-1,3}, A080003 {-2,-1,0,3}, A080006 {-2,-1,1,3}, A080009 {-2,-1,0,1,3}, A080007 {-2,-1,2,3}, A080010 {-2,-1,0,2,3}, A080012 {-2,-1,1,2,3}, A072827 {-2,-1,0,1,2,3}, A224809 {-2,0,4}, A189585 {-2,0,1,3,4}, A189581 {-2,-1,0,3,4}, A072850 {-2,-1,0,1,2,3,4}, A189587 {-2,0,1,3,4,5}, A189588 {-2,-1,0,3,4,5}, A189594 {-2,0,1,3,4,5,6}, A189595 {-2,-1,0,3,4,5,6}, A189601 {-2,0,1,3,4,5,6,7}, A189602 {-2,-1,0,3,4,5,6,7}, A224811 {-2,0,8}, A224812 {-2,0,10}, A224813 {-2,0,12}, A006500 {-3,0,3}, A079981 {-3,1,3}, A079983 {-3,0,1,3}, A079982 {-3,2,3}, A079984 {-3,0,2,3}, A079988 {-3,1,2,3}, A079989 {-3,0,1,2,3}, A079986 {-3,-1,1,3}, A079992 {-3,-1,0,1,3}, A079987 {-3,-1,2,3}, A079990 {-3,-1,0,2,3}, A079993 {-3,-1,1,2,3}, A079985 {-3,-2,2,3}, A079991 {-3,-2,0,2,3}, A079996 {-3,-2,0,1,2,3}, A079994 {-3,-2,1,2,3}, A079997 {-3,-2, -1,1,2,3}, A002526 {-3,-2,-1,0,1,2,3}, A189586 {-3,0,1,2,4}, A189583 {-3,-1,0,2,4}, A189582 {-3,-2,0,1,4}, A189584 {-3,-2,-1,0,4}, A189589 {-3,0,1,2,4,5}, A189590 {-3,-1,0,2,4,5}, A189591 {-3,-2,1,4,5}, A189592 {-3,-2,-1,0,4,5}, A224810 {-3,0,6}, A189596 {-3,0,1,2,4,5,6}, A189597 {-3,-1,0,2,4,5,6}, A189598 {-3,-2,0,1,4,5,6}, A189599 {-3,-2,-1,0,4,5,6}, A224814 {-3,0,9}, A031923 {-4,0,4}, A072856 {-4,-3, -2,-1,0,1,2,3,4}, A224815 {-4,0,8}, A154654 {-5,-4,-3,-2,-1,0,1,2,3,4,5}, A154655 {-6,-5,-4,-3, -2,-1,0,1,2,3,4,5,6}.
[Keyword "less", because this comment should be moved to the Index to the OEIS, it is not appropriate here. - N. J. A. Sloane, Oct 25 2024]

References

  • D. H. Lehmer, Permutations with strongly restricted displacements. Combinatorial theory and its applications, II (Proc. Colloq., Balatonfured, 1969), North-Holland, Amsterdam, 1970, pp. 755-770.

Crossrefs

See comments for other sequences related to strongly restricted permutations.

Programs

  • Mathematica
    CoefficientList[Series[(1 - x^3 - x^4 - x^6 + x^9)/(1 - x^3 - x^4 - x^5 - 2*x^6 - x^7 + 2*x^9 + 2*x^10 + x^12 - x^15),{x,0,49}],x]
    LinearRecurrence[{0, 0, 1, 1, 1, 2, 1, 0, -2, -2, 0, -1, 0, 0, 1}, {1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 5, 5, 6, 8}, 50]

Formula

a(n) = a(n-3) + a(n-4) + a(n-5) + 2*a(n-6) + a(n-7) - 2*a(n-9) - 2*a(n-10) - a(n-12) + a(n-15).
G.f.: (1 - x^3 - x^4 - x^6 + x^9)/(1 - x^3 - x^4 - x^5 - 2*x^6 - x^7 + 2*x^9 + 2*x^10 + x^12 - x^15).

A323801 Number of permutations p of [n] such that max_{j=1..n} |p(j)-j| = 5.

Original entry on oeis.org

0, 216, 1818, 10402, 50879, 234061, 1076807, 5090497, 24239396, 114890044, 539033760, 2502282836, 11522663348, 52848995167, 241925339959, 1106164932006, 5052307570906, 23047344846397, 104994467312301, 477733956914534, 2171607914492408, 9864023776496558
Offset: 5

Views

Author

Alois P. Heinz, Jan 28 2019

Keywords

Crossrefs

Column k=5 of A130152.

Formula

a(n) = A154654(n) - A072856(n).

A323802 Number of permutations p of [n] such that max_{j=1..n} |p(j)-j| = 6.

Original entry on oeis.org

0, 1320, 13656, 96090, 569602, 3111243, 16447329, 87358763, 475067757, 2607565996, 14310288148, 78087401424, 422646322560, 2269565277936, 12114270563852, 64454693890844, 342374934748155, 1817028234672099, 9636622425425550, 51069856507725138, 270408018010461065
Offset: 6

Views

Author

Alois P. Heinz, Jan 28 2019

Keywords

Crossrefs

Column k=6 of A130152.

Formula

a(n) = A154655(n) - A154654(n).
Showing 1-10 of 10 results.