login
Number of partitions of n into distinct parts such that the absolute difference between any part and the sum of all smaller parts is not larger than one.
2

%I #17 Dec 11 2020 13:40:18

%S 1,1,0,1,0,0,1,1,0,0,0,1,1,2,1,1,0,0,0,0,0,1,1,2,1,3,2,3,1,2,1,1,0,0,

%T 0,0,0,0,0,0,0,1,1,2,1,3,2,3,1,4,3,5,2,5,3,4,1,3,2,3,1,2,1,1,0,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,3,2,3,1,4,3,5,2,5,3,4,1,5,4,7,3,8,5,7,2

%N Number of partitions of n into distinct parts such that the absolute difference between any part and the sum of all smaller parts is not larger than one.

%H Alois P. Heinz, <a href="/A287146/b287146.txt">Table of n, a(n) for n = 0..16384</a>

%F a(2^n) = 0 for n > 0.

%F a(2^n-1) = 1 for n >= 0.

%e a(3) = 1: 21.

%e a(13) = 2: 6421, 7321.

%e a(25) = 3: (12)6421, (12)7321, (13)6321.

%p b:= proc(n, i) option remember; `if`(i*(i+1)/2<n, 0, `if`(n=0, 1,

%p b(n, i-1)+`if`(i>n or abs(i-(n-i))>1, 0, b(n-i, i-1))))

%p end:

%p a:= n-> b(n$2):

%p seq(a(n), n=0..120);

%t b[n_, i_] := b[n, i] = If[i(i+1)/2 < n, 0, If[n == 0, 1, b[n, i - 1] + If[i > n || Abs[i - (n - i)] > 1, 0, b[n - i, i - 1]]]];

%t a[n_] := b[n, n];

%t a /@ Range[0, 120] (* _Jean-François Alcover_, Dec 11 2020, after _Alois P. Heinz_ *)

%Y Cf. A000009, A002487, A287144.

%K nonn,look

%O 0,14

%A _Alois P. Heinz_, May 20 2017