A216717 Duplicate of A174072.
1, 2, 6, 24, 114, 674, 4714, 37754, 340404, 3412176, 37631268
Offset: 1
Keywords
Crossrefs
Duplicate of A174072.
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.
Since a(5)=22, there are (5-1)!-22=2 circular permutations with consecutive triples i,i+2,i+4 in all circular permutations of length 5. They are exactly (0,2,4,1,3) and (0,2,4,3,1).
From _Alois P. Heinz_, May 22 2012: (Start) a(3) = 5: {123, 132}, {213}, {231}, {312}, {321}. a(4) = 20: {1234, 1243, 1324}, {1342}, {1423}, {1432}, {2134}, {2143}, {2314}, {2341, 2431}, {2413}, {3124}, {3142}, {3214}, {3241}, {3412}, {3421}, {4123, 4132}, {4213}, {4231}, {4312}, {4321}. (End)
b:= proc(s, x, y) option remember; `if`(s={}, 1, add( `if`(x=0 or x-y<>1 or j-x<>1, b(s minus {j}, y, j), 0), j=s)) end: a:= n-> b({$1..n}, 0$2): seq(a(n), n=0..14); # Alois P. Heinz, Apr 14 2021 # second Maple program: a:= proc(n) option remember; `if`(n<5, [1$2, 2, 5, 20][n+1], n*a(n-1)+3*a(n-2)-(2*n-2)*a(n-3)+(n-2)*a(n-5)) end: seq(a(n), n=0..22); # Alois P. Heinz, Apr 14 2021
a[n_] := a[n] = If[n < 5, {1, 1, 2, 5, 20}[[n+1]], n*a[n-1] + 3*a[n-2] - (2n - 2)*a[n-3] + (n-2)*a[n-5]]; Table[a[n], {n, 0, 22}] (* Jean-François Alcover, Apr 20 2022, after Alois P. Heinz *)
my(N=30, x='x+O('x^N)); Vec(sum(k=0, N, k!*(x*(1-x^2))^k)) \\ Seiichi Manyama, Feb 20 2024
Triangle begins: 1 1 2 6 [this is for n=3] 24 114 6 674 44 2 4714 294 30 2 37754 2272 276 16 2 340404 20006 2236 216 16 2 3412176 193896 20354 2200 156 16 2 37631268 2056012 206696 20738 1908 160 16 2 ...
b:= proc(s, x, y) option remember; expand(`if`(s={}, 1, add( `if`(x>0 and x-y=2 and y-j=2, z, 1)*b(s minus {j}, y, j), j=s))) end: T:= n-> (p-> seq(coeff(p, z, i), i=0..degree(p)))(b({$1..n}, 0$2)): seq(T(n), n=0..12); # Alois P. Heinz, Apr 13 2021
b[s_, x_, y_] := b[s, x, y] = Expand[If[s == {}, 1, Sum[ If[x > 0 && x - y == 2 && y - j == 2, z, 1]* b[s ~Complement~ {j}, y, j], {j, s}]]]; T[n_] := Function[p, Table[Coefficient[p, z, i], {i, 0, Exponent[p, z]}]][b[Range[n], 0, 0]]; Table[T[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Mar 02 2022, after Alois P. Heinz *)
For example, a(5) does not count the permutation (0,4,1,3,2) since 4,1,3 is an arithmetic progression of 2 mod(5).
Since a(5)=18, there are (5-1)!-18=4 circular permutations with modular consecutive triples i,i+2,i+4 in all circular permutations of length 5. These are exactly (0,2,4,1,3), (0,2,4,3,1), (0,4,2,1,3), and (0,3,2,4,1). Note some have more than one modular progression.
f[i_,n_,k_]:=If[i==0 && k==0,1,If[i==n && n==k,1,Binomial[k-1,k-i]*Binomial[n-k-1,k-i-1] + 2*Binomial[k-1,k-i-1]*Binomial[n-k-1,k-i-1]+Binomial[k-1,k-i-1]*Binomial[n-k-1,k-i]]]; w1[i_,n_,k_]:=If[n-2k+i<0,0,If[n-2k+i==0,1,(n-2k+i-1)!]]; a[n_,k_]:=Sum[f[i,n,k]*w1[i,n,k],{i,0,k}]; A165962[n_]:=(n-1)!+Sum[(-1)^k*a[n,k],{k,1,n}]; b[n_,k_]:=Sum[Sum[Sum[f[j,n/2,p]*f[i-j,n/2,k-p]*w2[i,j,n,k,p],{p,0,k}],{j,0,i}],{i,0,k-1}]; w2[i_,j_,n_,k_,p_]:=If[n/2-2p+j<=0 || n/2-2(k-p)+(i-j)<=0,0,(n-2k+i-1)!]; A216727[n_?EvenQ]:=(n-1)!+Sum[(-1)^k*b[n,k],{k,1,n}]; A216727[n_?OddQ]:=A165962[n]; Table[A216727[n],{n,3,23}] (* David Scambler, Sep 18 2012 *)
Triangle begins: 1; 1, 1; [this is row n=3] 5, 0, 1; 20, 3, 0, 1; 102, 14, 3, 0, 1; 627, 72, 17, 3, 0, 1; 4461, 468, 87, 20, 3, 0, 1; 36155, 3453, 582, 103, 23, 3, 0, 1; 328849, 28782, 4395, 704, 120, 26, 3, 0, 1; 3317272, 267831, 37257, 5435, 834, 138, 29, 3, 0, 1; ...
For n=4, there are 4!-a(4)=3 permutations with some consecutive triple i,i+d,i+2d. Note for n=4, only d=1 applies. Hence those three permutations are (0,1,2,3), (1,2,3,0), and (3,0,1,2). Since here only d=1, this is the same value of a(4) in A002628.
b:= proc(s, x, y) option remember; `if`(s={}, 1, add( `if`(x=0 or xy-j, b(s minus {j}, y, j), 0), j=s)) end: a:= n-> b({$1..n}, 0$2): seq(a(n), n=0..14); # Alois P. Heinz, Apr 13 2021
b[s_, x_, y_] := b[s, x, y] = If[s == {}, 1, Sum[If[x == 0 || x < y || x-y != y-j, b[s~Complement~{j}, y, j], 0], {j, s}]]; a[n_] := b[Range[n], 0, 0]; Table[a[n], {n, 0, 14}] (* Jean-François Alcover, Sep 27 2022, after Alois P. Heinz *)
Comments