A239880 Number of strict partitions of n having an ordering in which no parts of equal parity are juxtaposed and the first and last terms have the same parity.
0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 7, 7, 10, 11, 14, 15, 19, 22, 26, 30, 35, 42, 47, 56, 62, 76, 83, 100, 108, 132, 142, 171, 184, 222, 239, 284, 306, 363, 394, 460, 500, 581, 636, 730, 802, 914, 1010, 1139, 1262, 1415, 1577, 1753, 1956, 2163, 2423, 2663
Offset: 0
Examples
a(12) counts these 7 partitions: [12], [9,2,1], [3,8,1], [7,4,1], [7,2,3], [5,6,1], [5,4,3].
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
Programs
-
Maple
b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or abs(t)-n>1, 0, `if`(n=0, abs(t), b(n, i-1, t)+ `if`(i>n, 0, b(n-i, i-1, t+(2*irem(i, 2)-1))))) end: a:= n-> b(n$2, 0): seq(a(n), n=0..80); # Alois P. Heinz, Apr 02 2014
-
Mathematica
d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &]; p[n_] := p[n] = Select[d[n], Abs[Count[#, ?OddQ] - Count[#, ?EvenQ]] == 1 &]; t = Table[p[n], {n, 0, 12}] TableForm[t] (* shows the partitions *) u = Table[Length[p[n]], {n, 0, 60}] (* A239880 *) (* Peter J. C. Moses, Mar 10 2014 *) b[n_, i_, t_] := b[n, i, t] = If[n > i*(i+1)/2 || Abs[t]-n>1, 0, If[n==0, Abs[t], b[n, i-1, t] + If[i>n, 0, b[n-i, i-1, t + (2*Mod[i, 2]-1)]]]]; a[n_] := b[n, n, 0]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Aug 29 2016, after Alois P. Heinz *)
Comments