OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2000
EXAMPLE
The a(4)=6 sums that add to 4 are 4, 3+1, 2+2, 2+1+1, 1+1+2 and 1+1+1+1. The 2 = 2^(n-1)-a(n) sums 1+2+1 and 1+3 do not satisfy the criterion and do not count.
From Joerg Arndt, May 21 2013: (Start)
The a(6)=17 such compositions are
01: [ 1 1 1 1 1 1 ]
02: [ 1 1 1 1 2 ]
03: [ 1 1 2 1 1 ]
04: [ 1 1 2 2 ]
05: [ 1 1 3 1 ]
06: [ 1 1 4 ]
07: [ 2 1 1 1 1 ]
08: [ 2 1 2 1 ]
09: [ 2 1 3 ]
10: [ 2 2 2 ]
11: [ 3 1 1 1 ]
12: [ 3 1 2 ]
13: [ 3 3 ]
14: [ 4 1 1 ]
15: [ 4 2 ]
16: [ 5 1 ]
17: [ 6 ]
(End)
MAPLE
A129853rec := proc(part, n) local asum, a, k ; asum := add(i, i=part) ; if asum > n then RETURN(0) ; elif asum = n then RETURN(1) ; else a := 0 ; if nops(part) mod 2 = 0 then for k from op(-1, part) to n-asum do a := a+A129853rec([op(part), k], n) ; od: else for k from 1 to min(op(-1, part), n-asum) do a := a+A129853rec([op(part), k], n) ; od: fi ; RETURN(a) ; fi ; end: A129853 := proc(n) local a, a1 ; a := 0 ; for a1 from 1 to n do a := a+A129853rec([a1], n) ; od: RETURN(a) ; end: seq(A129853(n), n=1..20) ; # R. J. Mathar, Oct 31 2007
# second Maple program:
b:= proc(n, l, t) option remember; `if`(n=0, 1, add(
b(n-j, j, not t), j=`if`(t, l..n, 1..min(n, l))))
end:
a:= n-> b(n, 1, true):
seq(a(n), n=0..40); # Alois P. Heinz, May 23 2023
MATHEMATICA
b[n_, l_, t_] := b[n, l, t] = If[n == 0, 1, Sum[b[n - j, j, !t], {j, If[t, Range[l, n], Range[Min[n, l]]]}]];
a[n_] := b[n, 1, True];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Aug 16 2023, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladeta Jovovic, May 22 2007
EXTENSIONS
More terms from R. J. Mathar, Oct 31 2007
More terms from Joerg Arndt, May 21 2013
a(0)=1 prepended by Alois P. Heinz, May 23 2023
STATUS
approved