Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #23 Jan 06 2021 08:28:15
%S 1,0,2,5,0,7,18,3,25,55,13,69,146,45,180,4,235,532,147,637,10,802,
%T 1804,549,2124,166,2602,5612,1894,6459,855,7697,16046,5903,18213,3330,
%U 21307,42944,16929,48114,10776,55359,2185,65446,140621,51487,157045,32291,179564
%N a(n) = a(n-1) + p(n) if p(n) > a(n-1), otherwise a(n) = a(n-1) - p(n), where p is the partition function A000041 (assuming a(n) = 0 for n < 0).
%H Alois P. Heinz, <a href="/A331165/b331165.txt">Table of n, a(n) for n = 0..10000</a>
%p a:= proc(n) option remember; `if`(n<0, 0, ((s, t)-> s+
%p `if`(s<t, t, -t))(a(n-1), combinat[numbpart](n)))
%p end:
%p seq(a(n), n=0..70);
%t a[n_] := a[n] = If[n<0, 0, With[{a1 = a[n-1], p = PartitionsP[n]}, If[p>a1, a1 + p, a1 - p]]];
%t a /@ Range[0, 70] (* _Jean-François Alcover_, Jan 05 2021 *)
%o (PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, my(p = numbpart(n-1)); va[n] = va[n-1] - p; if (va[n] < 0, va[n] += 2*p);); va;} \\ _Michel Marcus_, Jan 06 2021
%Y Cf. A000041, A008344, A008345, A008348, A076042, A111466, A126646, A327442, A330725.
%K nonn
%O 0,3
%A _Alois P. Heinz_, Jan 11 2020