%I #36 May 01 2024 07:18:51
%S 1,1,2,5,1,22,2,114,6,697,22,1,4923,114,3,39612,696,12,357899,4923,57,
%T 1,3588836,39612,348,4,39556420,357900,2460,20,475392841,3588836,
%U 19806,116,1,6187284605,39556420,178950,820,5,86701097310,475392840,1794420,6600,30
%N Triangle read by rows: T(n,k) is the number of permutations of [n] having k adjacent 3-cycles (0 <= k <= floor(n/3)), i.e., having k cycles of the form (i, i+1, i+2).
%C Row n contains 1 + floor(n/3) entries.
%C Sum of entries in row n = n! (A000142).
%H Seiichi Manyama, <a href="/A177250/b177250.txt">Rows n = 0..200, flattened</a>
%H R. A. Brualdi and Emeric Deutsch, <a href="http://arxiv.org/abs/1005.0781">Adjacent q-cycles in permutations</a>, arXiv:1005.0781 [math.CO], 2010.
%F T(n, k) = Sum_{j=0..floor(n/3)} (-1)^(k+j)*binomial(j,k)*(n-2j)!/j!.
%F T(n, 0) = A177251(n).
%F Sum_{k>=0} k*T(n,k) = (n-2)! (n>=3).
%F G.f. of column k: (1/k!) * Sum_{j>=k} j! * x^(j+2*k) / (1+x^3)^(j+1). - _Seiichi Manyama_, Feb 24 2024
%e T(7,2)=3 because we have (123)(456)(7), (123)(4)(567), and (1)(234)(567).
%e Triangle starts:
%e 1;
%e 1;
%e 2;
%e 5, 1;
%e 22, 2;
%e 114, 6;
%e 697, 22, 1;
%p T := proc (n, k) options operator, arrow: sum((-1)^(k+j)*binomial(j, k)*factorial(n-2*j)/factorial(j), j = 0 .. floor((1/3)*n)) end proc: for n from 0 to 14 do seq(T(n, k), k = 0 .. floor((1/3)*n)) end do; # yields sequence in triangular form
%t T[n_, k_] := Sum[(-1)^(k + j)*Binomial[j, k]*(n - 2 j)!/j!, {j, 0, n/3}];
%t Table[T[n, k], {n, 0, 14}, {k, 0, n/3}] // Flatten (* _Jean-François Alcover_, Nov 20 2017 *)
%o (Magma)
%o F:=Factorial;
%o A177250:= func< n,k | (&+[(-1)^j*F(n-2*k-2*j)/(F(k)*F(j)): j in [0..Floor((n-3*k)/3)]]) >;
%o [A177250(n,k): k in [0..Floor(n/3)], n in [0..12]]; // _G. C. Greubel_, Apr 28 2024
%o (SageMath)
%o f=factorial;
%o def A177250(n,k): return sum((-1)^j*f(n-2*k-2*j)/(f(k)*f(j)) for j in range(1+(n-3*k)//3))
%o flatten([[A177250(n,k) for k in range(1+n//3)] for n in range(13)]) # _G. C. Greubel_, Apr 28 2024
%Y Columns k=0..3 give A177251, A370525, A370528, A370530.
%Y Cf. A000142, A000166, A008290, A177248, A177249, A177252, A177253.
%K nonn,tabf
%O 0,3
%A _Emeric Deutsch_, May 07 2010
%E Crossreferences corrected by _Emeric Deutsch_, May 09 2010