%I #38 May 23 2024 20:53:16
%S 1,0,2,1,4,3,8,7,15,15,27,29,48,53,82,94,137,160,225,265,362,430,572,
%T 683,892,1066,1370,1640,2078,2487,3117,3725,4624,5519,6791,8092,9885,
%U 11752,14263,16922,20416,24167,29007,34254,40921,48213,57345,67409
%N a(n) = Sum_{k=0..n} (-1)^(n-k)*A000041(k).
%C Essentially first differences of A024786 (see the formula). Also, a(n) is the number of 2's in the last section of the set of partitions of n+2 (see A135010). - _Omar E. Pol_, Sep 10 2008
%C From _Gus Wiseman_, May 20 2024: (Start)
%C Also the number of integer partitions of n containing an even number of ones, ranked by A003159. The a(0) = 1 through a(8) = 15 partitions are:
%C () . (2) (3) (4) (5) (6) (7) (8)
%C (11) (22) (32) (33) (43) (44)
%C (211) (311) (42) (52) (53)
%C (1111) (222) (322) (62)
%C (411) (511) (332)
%C (2211) (3211) (422)
%C (21111) (31111) (611)
%C (111111) (2222)
%C (3311)
%C (4211)
%C (22211)
%C (41111)
%C (221111)
%C (2111111)
%C (11111111)
%C Also the number of integer partitions of n + 1 containing an odd number of ones, ranked by A036554.
%C (End)
%H Vaclav Kotesovec, <a href="/A087787/b087787.txt">Table of n, a(n) for n = 0..10000</a>
%F G.f.: 1/(1+x)*1/Product_{k>0} (1-x^k).
%F a(n) = 1/n*Sum_{k=1..n} (sigma(k)+(-1)^k)*a(n-k).
%F a(n) = A024786(n+2)-A024786(n+1). - _Omar E. Pol_, Sep 10 2008
%F a(n) ~ exp(Pi*sqrt(2*n/3)) / (8*sqrt(3)*n) * (1 + (11*Pi/(24*sqrt(6)) - sqrt(3/2)/Pi)/sqrt(n) - (11/16 + (23*Pi^2)/6912)/n). - _Vaclav Kotesovec_, Nov 05 2016
%F a(n) = A000041(n) - a(n-1). - _Jon Maiga_, Aug 29 2019
%F Alternating partial sums of A000041. - _Gus Wiseman_, May 20 2024
%t Table[Sum[(-1)^(n-k)*PartitionsP[k], {k,0,n}], {n,0,50}] (* _Vaclav Kotesovec_, Aug 16 2015 *)
%t (* more efficient program *) sig = 1; su = 1; Flatten[{1, Table[sig = -sig; su = su + sig*PartitionsP[n]; Abs[su], {n, 1, 50}]}] (* _Vaclav Kotesovec_, Nov 06 2016 *)
%t Table[Length[Select[IntegerPartitions[n], EvenQ[Count[#,1]]&]],{n,0,30}] (* _Gus Wiseman_, May 20 2024 *)
%o (Python)
%o from sympy import npartitions
%o def A087787(n): return sum(-npartitions(k) if n-k&1 else npartitions(k) for k in range(n+1)) # _Chai Wah Wu_, Oct 25 2023
%Y Cf. A000041, A024786, A135010, A138121, A141285.
%Y The unsigned version is A000070, strict A036469.
%Y For powers of 2 instead number of partitions we have A001045.
%Y The strict or odd version is A025147 or A096765.
%Y The ordered version (compositions instead of partitions) is A078008.
%Y For powers of 2 instead of -1 we have A259401, cf. A259400.
%Y A002865 counts partitions with no ones, column k=0 of A116598.
%Y A072233 counts partitions by sum and length.
%Y Cf. A000009, A003159, A026804, A027187, A027193, A036554, A058695, A101707.
%K nonn
%O 0,3
%A _Vladeta Jovovic_, Oct 07 2003