A289692 The number of partitions of [n] with exactly 2 blocks without peaks.
0, 1, 2, 4, 8, 15, 27, 48, 85, 150, 264, 464, 815, 1431, 2512, 4409, 7738, 13580, 23832, 41823, 73395, 128800, 226029, 396654, 696080, 1221536, 2143647, 3761839, 6601568, 11584945
Offset: 1
Links
- Muniru A Asiru, Table of n, a(n) for n = 1..300
- T. Mansour and M. Shattuck, Counting Peaks and Valleys in a Partition of a Set, J. Int. Seq. 13 (2010), 10.6.8, Table 1.
- Index entries for linear recurrences with constant coefficients, signature (3,-3,2,-1).
Programs
-
GAP
a:=[0, 1, 2, 4]; for n in [5..10^2] do a[n]:=3*a[n-1]-3*a[n-2]+2*a[n-3]-a[n-4]; od; a; # Muniru A Asiru, Jan 25 2018
-
Magma
I:=[0, 1, 2, 4]; [n le 4 select I[n] else 3*Self(n-1)-3*Self(n-2)+2*Self(n-3)-Self(n-4): n in [1..40]]; // Vincenzo Librandi, Jan 26 2018
-
Maple
a := proc(n) option remember: if n = 1 then 0 elif n = 2 then 1 elif n=3 then 2 elif n=4 then 4 elif n >= 5 then 3*procname(n-1) -3*procname(n-2)+2*procname(n-3)-procname(n-4) fi; end: seq(a(n), n = 0..100); # Muniru A Asiru, Jan 25 2018
-
Mathematica
LinearRecurrence[{3, -3, 2, -1}, {0, 1, 2, 4}, 40] (* Vincenzo Librandi, Jan 26 2018 *)
Formula
From Colin Barker, Nov 07 2017: (Start)
G.f.: x^2*(1 - x + x^2) / ((1 - x)*(1 - 2*x + x^2 - x^3)).
a(n) = 3*a(n-1) - 3*a(n-2) + 2*a(n-3) - a(n-4) for n>4. (End)
a(n) - a(n-1) = A005251(n). - R. J. Mathar, Mar 11 2021