%I #20 Sep 29 2015 15:33:18
%S 0,0,0,2,10,48,256,1670,12846,112820,1108612,12032154,142852450,
%T 1840969784,25587270600,381460235918,6071318154166,102742200205980,
%U 1841978156709676,34874169034136930,695294184953602602,14560120360421802464,319510983674891800240
%N Number of permutations of length n with exactly 2 rising or falling successions.
%C Permutations of 12...n such that exactly 2 of the following occur: 12, 23, ..., (n-1)n, 21, 32, ..., n(n-1).
%D F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263.
%H Alois P. Heinz, <a href="/A086853/b086853.txt">Table of n, a(n) for n = 0..200</a>
%H J. Riordan, <a href="http://projecteuclid.org/euclid.aoms/1177700181">A recurrence for permutations without rising or falling successions</a>, Ann. Math. Statist. 36 (1965), 708-710.
%F Coefficient of t^2 in S[n](t) defined in A002464.
%F Conjecture: (-514*n+2465)*a(n) +2*(257*n^2-955*n-1085)*a(n-1) +(-555*n^2+2483*n-1670)*a(n-2) +16*(-17*n^2+73*n-75)*a(n-3) +(354*n^2+528*n-2299)*a(n-4) +2*(-121*n^2+1045*n-1401)*a(n-5) +3*(67*n-115)*(n-4)*a(n-6)=0. - _R. J. Mathar_, Jun 06 2013
%F shorter recurrence: (n-3)*(n-2)*(n-4)^3*a(n) = (n-3)*(n^4-9*n^3+23*n^2-4*n-29)*(n-4)*a(n-1) - (n-1)*(n^4-12*n^3+57*n^2-125*n+104)*(n-4)*a(n-2) - (n-2)*(n-1)*(n^4-15*n^3+83*n^2-198*n+169)*a(n-3) + (n-3)^3*(n-2)^2*(n-1)*a(n-4). - _Vaclav Kotesovec_, Aug 10 2013
%F a(n) ~ 2*exp(-2) * n!. - _Vaclav Kotesovec_, Aug 10 2013
%p S:= proc(n) option remember; `if`(n<4, [1, 1, 2*t, 4*t+2*t^2]
%p [n+1], expand((n+1-t)*S(n-1) -(1-t)*(n-2+3*t)*S(n-2)
%p -(1-t)^2*(n-5+t)*S(n-3) +(1-t)^3*(n-3)*S(n-4)))
%p end:
%p a:= n-> ceil(coeff(S(n), t, 2)):
%p seq(a(n), n=0..25); # _Alois P. Heinz_, Jan 11 2013
%t s[n_] := s[n] = If[n<4, {1, 1, 2*t, 4*t+2*t^2}[[n+1]], Expand[(n+1-t)*s[n-1] - (1-t)*(n-2+3*t)*s[n-2] - (1-t)^2*(n-5+t)*s[n-3] + (1-t)^3*(n-3)*s[n-4]]]; t[n_, k_] := Ceiling[Coefficient[s[n], t, k]]; a[n_] := t[n, 2]; Table[a[n], {n, 0, 22}] (* _Jean-François Alcover_, Mar 11 2014, after _Alois P. Heinz_ *)
%Y Cf. A002464, A000130, A000349, A001267, A086852, A086854. A diagonal of A001100.
%K nonn
%O 0,4
%A _N. J. A. Sloane_, Aug 19 2003