login
Number of partitions of n such that the absolute difference between any part i and the sum of all other parts not larger than i is not larger than two.
2

%I #18 Dec 11 2020 12:56:22

%S 1,1,2,2,4,4,7,6,10,8,15,11,17,13,23,16,24,18,33,23,34,26,43,28,41,30,

%T 53,36,52,39,63,40,58,42,75,51,74,56,90,57,83,60,103,69,97,71,112,69,

%U 99,71,124,83,119,89,141,88,127,91,154,102,142,103,161,98

%N Number of partitions of n such that the absolute difference between any part i and the sum of all other parts not larger than i is not larger than two.

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

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

%F a(2^n) = A052542(n).

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

%e a(7) = 6: 31111, 3211, 322, 331, 4111, 421.

%e a(8) = 10: 32111, 3221, 3311, 332, 41111, 4211, 422, 431, 5111, 521.

%e a(9) = 8: 42111, 4221, 4311, 432, 51111, 5211, 522, 531.

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

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

%p end:

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

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

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

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

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

%Y Cf. A002487, A052542, A182780, A265278, A287146.

%K nonn,look

%O 0,3

%A _Alois P. Heinz_, May 20 2017