A240009
Number T(n,k) of partitions of n, where k is the difference between the number of odd parts and the number of even parts; triangle T(n,k), n>=0, -floor(n/2)+(n mod 2)<=k<=n, read by rows.
Original entry on oeis.org
1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 2, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 0, 1, 1, 2, 3, 2, 2, 2, 1, 1, 0, 1, 1, 1, 2, 2, 2, 4, 3, 2, 2, 1, 1, 0, 1, 1, 2, 4, 5, 3, 4, 4, 2, 2, 1, 1, 0, 1, 1, 1, 2, 3, 3, 5, 7, 5, 4, 4, 2, 2, 1, 1, 0, 1, 1, 2, 4, 7, 7, 6, 8, 6, 4, 4, 2, 2, 1, 1, 0, 1
Offset: 0
T(5,-1) = 1: [2,2,1].
T(5,0) = 2: [4,1], [3,2].
T(5,1) = 1: [5].
T(5,2) = 1: [2,1,1,1].
T(5,3) = 1: [3,1,1].
T(5,5) = 1: [1,1,1,1,1].
Triangle T(n,k) begins:
: n\k : -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 ...
+-----+----------------------------------------------------
: 0 : 1;
: 1 : 1;
: 2 : 1, 0, 0, 1;
: 3 : 1, 1, 0, 1;
: 4 : 1, 1, 0, 1, 1, 0, 1;
: 5 : 1, 2, 1, 1, 1, 0, 1;
: 6 : 1, 1, 1, 1, 2, 2, 1, 1, 0, 1;
: 7 : 1, 2, 3, 2, 2, 2, 1, 1, 0, 1;
: 8 : 1, 1, 2, 2, 2, 4, 3, 2, 2, 1, 1, 0, 1;
: 9 : 1, 2, 4, 5, 3, 4, 4, 2, 2, 1, 1, 0, 1;
: 10 : 1, 1, 2, 3, 3, 5, 7, 5, 4, 4, 2, 2, 1, 1, 0, 1;
Columns k=(-1)-10 give:
A239832,
A045931,
A240010,
A240011,
A240012,
A240013,
A240014,
A240015,
A240016,
A240017,
A240018,
A240019.
Row lengths give
A016777(floor(n/2)).
Cf.
A240021 (the same for partitions into distinct parts),
A242618 (the same for parts counted without multiplicity).
-
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
expand(b(n, i-1)+`if`(i>n, 0, b(n-i, i)*x^(2*irem(i, 2)-1)))))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=ldegree(p)..degree(p)))(b(n$2)):
seq(T(n), n=0..14);
-
b[n_, i_] := b[n, i] = If[n == 0, 1, If[i<1, 0, b[n, i-1] + If[i>n, 0, b[n-i, i]*x^(2*Mod[i, 2]-1)]]]; T[n_] := (degree = Exponent[b[n, n], x]; ldegree = -Exponent[b[n, n] /. x -> 1/x, x]; Table[Coefficient[b[n, n], x, i], {i, ldegree, degree}]); Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Jan 06 2015, translated from Maple *)
-
N=20; q='q+O('q^N);
e(n) = if(n%2!=0, u, 1/u);
gf = 1 / prod(n=1,N, 1 - e(n)*q^n );
V = Vec( gf );
{ for (j=1, #V, \\ print triangle, including leading zeros
for (i=0, N-j, print1(" ")); \\ padding
for (i=-j+1, j-1, print1(polcoeff(V[j], i, u),", "));
print();
); }
/* Joerg Arndt, Mar 31 2014 */
A239829
Triangular array: T(n,k) = number of partitions of 2n - 1 that have alternating sum 2k - 1.
Original entry on oeis.org
1, 2, 1, 4, 2, 1, 7, 5, 2, 1, 12, 10, 5, 2, 1, 19, 19, 10, 5, 2, 1, 30, 33, 20, 10, 5, 2, 1, 45, 57, 36, 20, 10, 5, 2, 1, 67, 92, 64, 36, 20, 10, 5, 2, 1, 97, 147, 107, 65, 36, 20, 10, 5, 2, 1, 139, 227, 177, 110, 65, 36, 20, 10, 5, 2, 1, 195, 345, 282, 184
Offset: 1
First nine rows:
1
2 ... 1
4 ... 2 ... 1
7 ... 5 ... 2 ... 1
12 .. 10 .. 5 ... 2 ... 1
19 .. 19 .. 10 .. 5 ... 2 ... 1
30 .. 33 .. 20 .. 10 .. 5 ... 2 ... 1
45 .. 57 .. 36 .. 20 .. 10 .. 5 ... 2 ... 1
67 .. 92 .. 64 .. 36 .. 20 .. 10 .. 5 ... 2 ... 1
The partitions of 5 are 5, 41, 32, 311, 221, 2111, 11111, with respective alternating sums 5, 3, 1, 3, 1, 1, 1, so that row 2 of the array is 4 .. 2 .. 1.
-
b:= proc(n, i, t) option remember; `if`(n=0, x^(1/2), `if`(i<1, 0,
expand(b(n, i-1, t)+`if`(i>n, 0, b(n-i, i, -t)*x^((t*i)/2)))))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(2*n-1$2, 1)):
seq(T(n), n=1..14); # Alois P. Heinz, Mar 30 2014
-
z = 15; s[w_] := s[w] = Total[Take[#, ;; ;; 2]] - Total[Take[Rest[#], ;; ;; 2]] &[w]; c[n_] := c[n] = Table[s[IntegerPartitions[n][[k]]], {k, 1, PartitionsP[n]}]; t[n_, k_] := Count[c[2 n - 1], 2 k - 1]; u = Table[t[n, k], {n, 1, z}, {k, 1, n}]
TableForm[u] (* A239829, array *)
Flatten[u] (* A239829, sequence *)
(* Peter J. C. Moses, Mar 21 2014 *)
b[n_, i_, t_] := b[n, i, t] = If[n == 0, x^(1/2), If[i<1, 0, Expand[b[n, i-1, t] + If[i>n, 0, b[n-i, i, -t]*x^((t*i)/2)]]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 1, n}]][b[2n-1, 2n-1, 1]]; Table[T[n], {n, 1, 14}] // Flatten (* Jean-François Alcover, Aug 27 2016, after Alois P. Heinz *)
A239833
Number of partitions of n having an ordering of parts in which no parts of equal parity are adjacent and the first and last terms have the same parity.
Original entry on oeis.org
0, 1, 1, 1, 2, 2, 3, 4, 6, 7, 10, 13, 17, 22, 28, 36, 46, 58, 72, 92, 113, 141, 174, 216, 263, 324, 394, 481, 583, 707, 852, 1029, 1235, 1481, 1774, 2118, 2524, 3003, 3567, 4225, 5003, 5906, 6968, 8202, 9646, 11317, 13275, 15531, 18160, 21195, 24718, 28772
Offset: 0
a(10) counts these 10 partitions: [10], [1,8,1], [7,2,1], [3,6,1], [5,4,1], [5,3,2], [3,4,3], [4,1,2,1,2], [2,3,2,1,2], [1,2,1,2,1,2,1].
-
b:= proc(n, i, t) option remember; `if`(abs(t)>n, 0,
`if`(n=0, 1, `if`(i<1, 0, b(n, i-1, t)+
`if`(i>n, 0, b(n-i, i, t+(2*irem(i, 2)-1))))))
end:
a:= n-> b(n$2, -1) +b(n$2, 1):
seq(a(n), n=0..80); # Alois P. Heinz, Apr 02 2014
-
p[n_] := p[n] = Select[IntegerPartitions[n], Abs[Count[#, ?OddQ] - Count[#, ?EvenQ]] == 1 &]; t = Table[p[n], {n, 0, 10}]
TableForm[t] (* shows the partitions*)
t = Table[Length[p[n]], {n, 0, 60}] (* A239833 *)
(* Peter J. C. Moses, Mar 10 2014 *)
b[n_, i_, t_] := b[n, i, t] = If[Abs[t]>n, 0, If[n==0, 1, If[i<1, 0, b[n, i-1, t] + If[i>n, 0, b[n-i, i, t+(2*Mod[i, 2]-1)]]]]]; a[n_] := b[n, n, -1] + b[n, n, 1]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Oct 12 2015, after Alois P. Heinz *)
A239871
Number of strict partitions of n having 1 more even part than odd, so that there is at least one ordering of the parts in which the even and odd parts alternate, and the first and last terms are even.
Original entry on oeis.org
0, 0, 1, 0, 1, 0, 1, 1, 1, 2, 1, 4, 1, 6, 1, 9, 2, 12, 3, 16, 6, 20, 10, 25, 17, 30, 26, 36, 40, 43, 57, 51, 81, 61, 110, 74, 148, 91, 193, 113, 250, 144, 316, 184, 397, 239, 491, 311, 603, 407, 732, 530, 885, 692, 1061, 895, 1268, 1155, 1508, 1478, 1790
Offset: 0
a(11) counts these 4 partitions: 812, 614, 632, 452.
-
b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or
abs(t)>n, 0, `if`(n=0, 1, 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, 1):
seq(a(n), n=0..80); # Alois P. Heinz, Apr 02 2014
-
d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &];
p[n_] := p[n] = Select[d[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t = Table[p[n], {n, 0, 20}]
TableForm[t] (* shows the partitions *)
u = Table[Length[p[n]], {n, 0, 70}] (* A239871 *)
(* Peter J. C. Moses, Mar 10 2014 *)
b[n_, i_, t_] := b[n, i, t] = If[n > i*(i + 1)/2 || Abs[t] > n, 0, If[n == 0, 1, 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, 1]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Nov 16 2015, after Alois P. Heinz *)
A239835
Number of partitions of n such that the absolute value of the difference between the number of odd parts and the number of even parts is <=1.
Original entry on oeis.org
1, 1, 1, 2, 2, 4, 4, 7, 8, 12, 15, 20, 26, 33, 44, 54, 71, 86, 113, 136, 175, 211, 268, 323, 403, 487, 601, 726, 885, 1068, 1292, 1556, 1867, 2244, 2678, 3208, 3809, 4547, 5379, 6398, 7542, 8937, 10506, 12404, 14542, 17110, 20011, 23465, 27381, 32006, 37267
Offset: 0
a(8) counts these 8 partitions: 8, 161, 521, 341, 4121, 323, 3212, 21212.
-
b:= proc(n, i, t) option remember; `if`(abs(t)-n>1, 0,
`if`(n=0, 1, `if`(i<1, 0, b(n, i-1, t)+
`if`(i>n, 0, b(n-i, i, t+(2*irem(i, 2)-1))))))
end:
a:= n-> b(n$2, 0):
seq(a(n), n=0..80); # Alois P. Heinz, Apr 01 2014
-
p[n_] := p[n] = Select[IntegerPartitions[n], Abs[Count[#, ?OddQ] - Count[#, ?EvenQ]] <= 1 &]; t = Table[p[n], {n, 0, 10}]
TableForm[t] (* shows the partitions *)
Table[Length[p[n]], {n, 0, 60}] (* A239835 *)
(* Peter J. C. Moses, Mar 10 2014 *)
b[n_, i_, t_] := b[n, i, t] = If[Abs[t]-n>1, 0, If[n==0, 1, If[i<1, 0, b[n, i-1, t] + If[i>n, 0, b[n-i, i, t+(2*Mod[i, 2]-1)]]]]]; a[n_] := b[n, n, 0]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Nov 16 2015, after Alois P. Heinz *)
A239872
Number of strict partitions of 2n having 1 more even part than odd, so that there is at least one ordering of the parts in which the even and odd parts alternate, and the first and last terms are even.
Original entry on oeis.org
0, 1, 1, 1, 1, 1, 1, 1, 2, 3, 6, 10, 17, 26, 40, 57, 81, 110, 148, 193, 250, 316, 397, 491, 603, 732, 885, 1061, 1268, 1508, 1790, 2120, 2510, 2970, 3517, 4170, 4950, 5887, 7013, 8371, 10005, 11979, 14353, 17217, 20654, 24785, 29725, 35637, 42672, 51046, 60962
Offset: 0
a(9) counts these 3 partitions of 18: [18], [8,3,4,1,2], [6,5,4,1,2].
-
b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or
abs(t)-n>0, 0, `if`(n=0, 1, b(n, i-1, t)+
`if`(i>n, 0, b(n-i, i-1, t+(2*irem(i, 2)-1)))))
end:
a:= n-> b(2*n$2, 1):
seq(a(n), n=0..60); # Alois P. Heinz, Apr 01 2014
-
d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &]; p[n_] := p[n] = Select[d[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t = Table[p[n], {n, 0, 20}]
TableForm[t] (* shows the partitions *)
u = Table[Length[p[2 n]], {n, 0, 40}] (* A239872 *)
(* Peter J. C. Moses, Mar 10 2014 *)
b[n_, i_, t_] := b[n, i, t] = If[n > i*(i+1)/2 || Abs[t]-n > 0, 0, If[n == 0, 1, b[n, i-1, t] + If[i>n, 0, b[n-i, i-1, t + (2*Mod[i, 2] - 1)]]]]; a[n_] := b[2*n, 2*n, 1]; Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Oct 28 2015, after Alois P. Heinz *)
A239873
Number of strict partitions of 2n + 1 having 1 more even part than odd, so that there is at least one ordering of the parts in which the even and odd parts alternate, and the first and last terms are even.
Original entry on oeis.org
0, 0, 0, 1, 2, 4, 6, 9, 12, 16, 20, 25, 30, 36, 43, 51, 61, 74, 91, 113, 144, 184, 239, 311, 407, 530, 692, 895, 1155, 1478, 1882, 2375, 2983, 3715, 4602, 5660, 6925, 8418, 10187, 12257, 14686, 17514, 20809, 24624, 29049, 34154, 40051, 46842, 54668, 63667
Offset: 0
a(7) counts these 9 partitions of 15: [12,1,2], [10,1,4], [10,3,2], [4,9,2], [8,1,6], [8,5,2], [8,3,4], [6,7,2], [6,5,4].
-
b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or
abs(t)>n, 0, `if`(n=0, 1, b(n, i-1, t)+
`if`(i>n, 0, b(n-i, i-1, t+(2*irem(i, 2)-1)))))
end:
a:= n-> b(2*n+1$2, 1):
seq(a(n), n=0..80); # Alois P. Heinz, Apr 02 2014
-
d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &]; p[n_] := p[n] = Select[d[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t = Table[p[n], {n, 0, 20}]
TableForm[t] (* shows the partitions *)
u = Table[Length[p[2 n + 1]], {n, 0, 38}] (* A239873 *)
(* Peter J. C. Moses, Mar 10 2014 *)
b[n_, i_, t_] := b[n, i, t] = If[n > i (i + 1)/2 || Abs[t] > n, 0, If[n == 0, 1, b[n, i-1, t] + If[i>n, 0, b[n-i, i-1, t + (2 Mod[i, 2] - 1)]]]]; a[n_] := b[2n+1, 2n+1, 1]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Aug 29 2016, after Alois P. Heinz *)
Showing 1-7 of 7 results.
Comments