A209423
Difference between the number of odd parts and the number of even parts in all the partitions of n.
Original entry on oeis.org
1, 1, 4, 4, 10, 13, 24, 30, 52, 68, 105, 137, 202, 264, 376, 485, 669, 864, 1162, 1486, 1968, 2501, 3256, 4110, 5285, 6630, 8434, 10511, 13241, 16417, 20505, 25273, 31344, 38438, 47346, 57782, 70746, 85947, 104663, 126594, 153386, 184793, 222865, 267452
Offset: 1
The partitions of 5 are [5], [4,1], [3,2], [3,1,1], [2,2,1], [2,1,1,1], and [1,1,1,1,1], a total of 15 odd parts and 5 even parts, so that a(5)=10.
-
b:= proc(n, i) option remember; local m, f, g;
m:= irem(i, 2);
if n=0 then [1, 0, 0]
elif i<1 then [0, 0, 0]
else f:= b(n, i-1); g:= `if`(i>n, [0$3], b(n-i, i));
[f[1]+g[1], f[2]+g[2]+m*g[1], f[3]+g[3]+(1-m)*g[1]]
fi
end:
a:= n-> b(n, n)[2] -b(n, n)[3]:
seq(a(n), n=1..50); # Alois P. Heinz, Jul 09 2012
g := add(x^j/(1+x^j), j = 1 .. 80)/mul(1-x^j, j = 1 .. 80): gser := series(g, x = 0, 50): seq(coeff(gser, x, n), n = 0 .. 45); # Emeric Deutsch, Feb 08 2016
-
f[n_, i_] := Count[Flatten[IntegerPartitions[n]], i]
o[n_] := Sum[f[n, i], {i, 1, n, 2}]
e[n_] := Sum[f[n, i], {i, 2, n, 2}]
Table[o[n], {n, 1, 45}] (* A066897 *)
Table[e[n], {n, 1, 45}] (* A066898 *)
%% - % (* A209423 *)
b[n_, i_] := b[n, i] = Module[{m, f, g}, m = Mod[i, 2]; If[n==0, {1, 0, 0}, If[i<1, {0, 0, 0}, f = b[n, i-1]; g = If[i>n, {0, 0, 0}, b[n-i, i]]; {f[[1]] + g[[1]], f[[2]] + g[[2]] + m*g[[1]], f[[3]] + g[[3]] + (1-m)* g[[1]]}]]]; a[n_] := b[n, n][[2]] - b[n, n][[3]]; Table[a[n], {n, 1, 50}] (* Jean-François Alcover, Nov 16 2015, after Alois P. Heinz *)
A171967
Number of partitions of n with distinct numbers of odd and even parts.
Original entry on oeis.org
0, 1, 2, 2, 5, 5, 10, 12, 20, 25, 37, 49, 68, 90, 119, 158, 206, 269, 344, 446, 565, 722, 908, 1148, 1435, 1795, 2229, 2765, 3416, 4204, 5164, 6315, 7717, 9380, 11406, 13793, 16692, 20093, 24203, 29012, 34799, 41552, 49636, 59059, 70279, 83341, 98822
Offset: 0
-
b:= proc(n, i, t) option remember; `if`(n=0,
`if`(t<>0, 1, 0), `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, Mar 30 2014
-
$RecursionLimit = 1000; b[n_, i_, t_] := b[n, i, t] = If[n==0, If[t != 0, 1, 0], 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, Jun 30 2015, after Alois P. Heinz *)
A239832
Number of partitions of n having 1 more even part than odd, so that there is an ordering of parts for 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, 1, 1, 2, 2, 4, 3, 7, 6, 11, 11, 17, 19, 27, 31, 41, 51, 62, 79, 95, 121, 142, 182, 212, 269, 314, 393, 459, 570, 665, 816, 958, 1160, 1364, 1639, 1928, 2297, 2706, 3200, 3768, 4434, 5212, 6105, 7170, 8361, 9799, 11396, 13322, 15450, 18022
Offset: 0
The three partitions counted by a(10) are [10], [4,1,2,1,2], and [2,3,2,1,2].
-
p[n_] := p[n] = Select[IntegerPartitions[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t = Table[p[n], {n, 0, 10}]
TableForm[t] (* shows the partitions *)
Table[Length[p[n]], {n, 0, 30}] (* A239832 *)
(* Peter J. C. Moses, Mar 10 2014 *)
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 *)
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 *)
A240010
Number of partitions of n, where the difference between the number of odd parts and the number of even parts is 1.
Original entry on oeis.org
1, 0, 1, 1, 1, 2, 2, 4, 3, 7, 6, 11, 11, 17, 19, 27, 31, 41, 51, 62, 79, 95, 121, 142, 182, 212, 269, 314, 393, 459, 570, 665, 816, 958, 1160, 1364, 1639, 1928, 2297, 2706, 3200, 3768, 4434, 5212, 6105, 7170, 8361, 9799, 11396, 13322, 15450, 18022, 20850
Offset: 1
a(9) = 3: [9], [4,2,1,1,1], [3,2,2,1,1].
a(10) = 7: [8,1,1], [7,2,1], [6,3,1], [5,4,1], [5,3,2], [4,3,3], [2,2,2,1,1,1,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):
seq(a(n), n=1..80);
-
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];
Array[a, 80] (* Jean-François Alcover, Dec 10 2020, after Alois P. Heinz *)
A240011
Number of partitions of n, where the difference between the number of odd parts and the number of even parts is 2.
Original entry on oeis.org
1, 0, 1, 1, 2, 2, 3, 4, 5, 8, 8, 13, 14, 21, 23, 34, 37, 52, 60, 79, 93, 120, 143, 178, 216, 263, 321, 386, 470, 560, 684, 806, 980, 1154, 1395, 1636, 1969, 2304, 2758, 3225, 3835, 4480, 5305, 6186, 7288, 8495, 9961, 11594, 13545, 15742, 18325, 21269, 24675
Offset: 2
a(10) = 5: [9,1], [7,3], [5,5], [4,2,1,1,1,1], [3,2,2,1,1,1].
a(11) = 8: [8,1,1,1], [7,2,1,1], [6,3,1,1], [5,4,1,1], [5,3,2,1], [4,3,3,1], [3,3,3,2], [2,2,2,1,1,1,1,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, -2):
seq(a(n), n=2..80);
-
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, -2];
a /@ Range[2, 80] (* Jean-François Alcover, Dec 10 2020, after Alois P. Heinz *)
A240012
Number of partitions of n, where the difference between the number of odd parts and the number of even parts is 3.
Original entry on oeis.org
1, 0, 1, 1, 2, 2, 4, 4, 6, 8, 10, 14, 17, 23, 27, 38, 43, 59, 69, 91, 106, 139, 162, 207, 245, 306, 364, 449, 534, 650, 778, 934, 1117, 1334, 1592, 1887, 2251, 2652, 3155, 3705, 4391, 5139, 6075, 7086, 8347, 9720, 11406, 13252, 15505, 17978, 20965, 24272
Offset: 3
-
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, -3):
seq(a(n), n=3..80);
-
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, -3];
a /@ Range[3, 80] (* Jean-François Alcover, Dec 10 2020, after Alois P. Heinz *)
A240013
Number of partitions of n, where the difference between the number of odd parts and the number of even parts is 4.
Original entry on oeis.org
1, 0, 1, 1, 2, 2, 4, 4, 7, 8, 11, 14, 19, 24, 30, 40, 48, 63, 76, 98, 117, 151, 178, 227, 269, 337, 399, 496, 586, 720, 854, 1036, 1228, 1481, 1752, 2096, 2480, 2946, 3481, 4115, 4850, 5707, 6717, 7868, 9237, 10789, 12632, 14707, 17181, 19947, 23243, 26925
Offset: 4
-
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, -4):
seq(a(n), n=4..80);
-
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, -4];
a /@ Range[4, 80] (* Jean-François Alcover, Dec 10 2020, after Alois P. Heinz *)
A240014
Number of partitions of n, where the difference between the number of odd parts and the number of even parts is 5.
Original entry on oeis.org
1, 0, 1, 1, 2, 2, 4, 4, 7, 8, 12, 14, 20, 24, 32, 41, 51, 65, 81, 102, 125, 158, 190, 239, 287, 357, 426, 528, 626, 769, 913, 1110, 1314, 1590, 1877, 2255, 2660, 3174, 3738, 4439, 5215, 6162, 7230, 8502, 9954, 11666, 13626, 15911, 18551, 21590, 25118, 29154
Offset: 5
-
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, -5):
seq(a(n), n=5..80);
-
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, -5];
a /@ Range[5, 80] (* Jean-François Alcover, Dec 10 2020, after Alois P. Heinz *)
Comments