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.

Previous Showing 11-14 of 14 results.

A323671 Number T(n,k) of permutations p of [n] with no fixed points such that |{ j : |p(j)-j| = 1 }| = k; triangle T(n,k), n >= 0, 0 <= k <= n, read by rows.

Original entry on oeis.org

1, 0, 0, 0, 0, 1, 0, 0, 2, 0, 1, 2, 3, 2, 1, 4, 12, 14, 8, 6, 0, 29, 68, 82, 54, 25, 6, 1, 206, 496, 546, 376, 170, 48, 12, 0, 1708, 3960, 4349, 2922, 1353, 430, 98, 12, 1, 15702, 35816, 38632, 26048, 12084, 4052, 982, 160, 20, 0, 159737, 358786, 383523, 257552, 120919, 41508, 10647, 1998, 270, 20, 1
Offset: 0

Views

Author

Alois P. Heinz, Jan 23 2019

Keywords

Examples

			T(4,0) = 1: 3412.
T(4,1) = 2: 3421, 4312.
T(4,2) = 3: 2413, 3142, 4321.
T(4,3) = 2: 2341, 4123.
T(4,4) = 1: 2143.
Triangle T(n,k) begins:
      1;
      0,     0;
      0,     0,     1;
      0,     0,     2,     0;
      1,     2,     3,     2,     1;
      4,    12,    14,     8,     6,    0;
     29,    68,    82,    54,    25,    6,   1;
    206,   496,   546,   376,   170,   48,  12,   0;
   1708,  3960,  4349,  2922,  1353,  430,  98,  12,  1;
  15702, 35816, 38632, 26048, 12084, 4052, 982, 160, 20, 0;
  ...
		

Crossrefs

Column k=0 gives A001883.
Row sums give A000166.
Main diagonal and lower diagonal give A059841, A110660.

Programs

  • Maple
    b:= proc(s) option remember; expand((n-> `if`(n=0, 1, add(
          (t-> `if`(t=0, 0, `if`(t=1, x, 1)*b(s minus {j}))
           )(abs(n-j)), j=s)))(nops(s)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b({$1..n})):
    seq(T(n), n=0..12);
  • Mathematica
    b[s_] := b[s] = Expand[Function[n, If[n==0, 1, Sum[Function[t, If[t==0, 0, If[t==1, x, 1]*b[s~Complement~{j}]]][Abs[n-j]], {j, s}]]][Length[s]]];
    T[n_] := PadRight[CoefficientList[b[Range[n]], x], n+1];
    T /@ Range[0, 12] // Flatten (* Jean-François Alcover, Feb 09 2021, after Alois P. Heinz *)

Formula

Sum_{k=1..n} T(n,k) = A296050(n).

A077612 Number of adjacent pairs of form (even,even) among all permutations of {1,2,...,n}.

Original entry on oeis.org

0, 0, 0, 12, 48, 720, 4320, 60480, 483840, 7257600, 72576000, 1197504000, 14370048000, 261534873600, 3661488230400, 73229764608000, 1171676233728000, 25609494822912000, 460970906812416000, 10948059036794880000, 218961180735897600000, 5620003638888038400000
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Floor[n/2]*Floor[n/2 - 1]*(n - 1)!; Array[a, 25] (* Amiram Eldar, Jan 22 2023 *)
  • PARI
    a(n) = n\2 * (n\2-1)*(n-1)! ; \\ Michel Marcus, Aug 29 2013

Formula

a(n) = floor(n/2)*floor(n/2-1)*(n-1)!. Proof: There are floor(n/2)*floor(n/2-1) pairs (r, s) with r and s even and distinct. For each pair, there are n-1 places it can occur in a permutation and (n-2)! possible arrangements of the other numbers.
a(n) = A110660(n+2) * A000142(n-1). - Michel Marcus, Aug 29 2013
Sum_{n>=4} 1/a(n) = CoshIntegral(1) - gamma - 3*e + 8 = A099284 - A001620 - 3*A001113 + 8. - Amiram Eldar, Jan 22 2023

A235367 Sum of positive even numbers up to n^2.

Original entry on oeis.org

0, 6, 20, 72, 156, 342, 600, 1056, 1640, 2550, 3660, 5256, 7140, 9702, 12656, 16512, 20880, 26406, 32580, 40200, 48620, 58806, 69960, 83232, 97656, 114582, 132860, 154056, 176820, 202950, 230880, 262656, 296480, 334662, 375156, 420552, 468540, 522006, 578360, 640800, 706440, 778806
Offset: 1

Views

Author

Réjean Labrie, Jan 07 2014

Keywords

Comments

Consider a square array of side n in which we write the integers from 1 to n in any order. This sequence gives the sum of the even numbers in the array.

Examples

			a(1) = 0 because there are no even numbers between 1 and itself.
a(2) = 6 because between 1 and 2^2 there are the even numbers 2 and 4, which add up to 6.
a(3) = 20 because between 1 and 3^2 there are the even numbers 2, 4, 6 and 8, which add up to 20.
		

Crossrefs

Programs

  • Magma
    [&+[i: i in [0..n^2 by 2]]: n in [1..50]]; // Bruno Berselli, Oct 26 2018
  • Mathematica
    Table[((n^2 - Mod[n^2, 2])/4)(n^2 + 2 - Mod[n^2, 2]), {n, 40}] (* Alonso del Arte, Jan 16 2014 *)
  • PARI
    a(n) = sum(i=1, n, i^2*(!(i % 2))); \\ Michel Marcus, Jan 18 2014
    

Formula

a(n) = (n^4 + 2n^2)/4 if n is even, a(n) = (n^4 - 1)/4 if n is odd.
a(n) = ((n^2 - (n^2 mod 2))/4)(n^2 + 2 - (n^2 mod 2)). - Alonso del Arte, Jan 16 2014
a(n) = A110660(n^2). - Michel Marcus, Jan 18 2014
G.f.: -2*x^2*(3*x^4+4*x^3+10*x^2+4*x+3) / ((x-1)^5*(x+1)^3). - Colin Barker, Jan 18 2014

Extensions

Corrected by Vincenzo Librandi, Jan 18 2014

A239287 Triangle T(n,k), 0 <= k <= n, read by rows: T(n,k) = floor(n/2) - min(k,n-k).

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 2, 1, 0, 1, 2, 2, 1, 0, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2
Offset: 0

Views

Author

Philippe Deléham, Mar 14 2014

Keywords

Comments

Row sums are A110660(n).

Examples

			Triangle begins:
0;
0, 0;
1, 0, 1;
1, 0, 0, 1;
2, 1, 0, 1, 2;
2, 1, 0, 0, 1, 2;
3, 2, 1, 0, 1, 2, 3;
3, 2, 1, 0, 0, 1, 2, 3;
4, 3, 2, 1, 0, 1, 2, 3, 4;
4, 3, 2, 1, 0, 0, 1, 2, 3, 4;
5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5;
5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5;
6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6;
6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6;
7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7;
7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7;
8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8;
8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8;
9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
		

Crossrefs

Cf. A004526.

Programs

  • Magma
    [[Floor(n/2) - Min(k,n-k): k in [0..n]]: n in [0..10]]; // G. C. Greubel, May 26 2018
  • Mathematica
    Column[Table[Floor[n/2] - Min[k, n - k], {n,0, 19}, {k, 0, n}]] (* Indranil Ghosh, Mar 15 2017 *)
  • PARI
    tabl(nn) = {for(n=0, nn, for(k=0, n, print1(floor(n/2) - min(k, n - k),", ");); print(););};
    tabl(19); \\ Indranil Ghosh, Mar 15 2017
    
  • Python
    i=0
    for n in range(0,20):
        for k in range(0, n+1):
            print(str(i)+" "+str((n//2) - min(k, n - k)))
            i+=1 # Indranil Ghosh, Mar 15 2017
    

Formula

T(n,k) = floor(n/2) - min(k,n-k).
Previous Showing 11-14 of 14 results.