%I #28 Oct 25 2023 14:59:00
%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
%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
%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 *)
%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.
%K nonn
%O 0,3
%A _Vladeta Jovovic_, Oct 07 2003
|