login
Nondescending wiggly sums: number of sums adding to n in which terms alternately do not decrease and do not increase.
29

%I #23 May 23 2023 16:16:09

%S 1,1,2,3,5,9,15,26,45,79,135,236,408,710,1230,2137,3705,6436,11165,

%T 19384,33637,58391,101336,175896,305284,529884,919683,1596277,2770576,

%U 4808811,8346446,14486644,25143896,43641363,75746646,131470683,228188723,396058740,687424365,1193136983,2070883422

%N Nondescending wiggly sums: number of sums adding to n in which terms alternately do not decrease and do not increase.

%H Alois P. Heinz, <a href="/A129852/b129852.txt">Table of n, a(n) for n = 0..2000</a>

%e From _Joerg Arndt_, May 21 2013: (Start)

%e The a(6)=15 such compositions are

%e 01: [ 1 1 1 1 1 1 ]

%e 02: [ 1 1 1 2 1 ]

%e 03: [ 1 1 1 3 ]

%e 04: [ 1 2 1 1 1 ]

%e 05: [ 1 2 1 2 ]

%e 06: [ 1 3 1 1 ]

%e 07: [ 1 3 2 ]

%e 08: [ 1 4 1 ]

%e 09: [ 1 5 ]

%e 10: [ 2 2 1 1 ]

%e 11: [ 2 2 2 ]

%e 12: [ 2 3 1 ]

%e 13: [ 2 4 ]

%e 14: [ 3 3 ]

%e 15: [ 6 ]

%e (End)

%p A129852rec := 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 = 1 then for k from op(-1,part) to n-asum do a := a+A129852rec([op(part),k],n) ; od: else for k from 1 to min(op(-1,part),n-asum) do a := a+A129852rec([op(part),k],n) ; od: fi ; RETURN(a) ; fi ; end: A129852 := proc(n) local a,a1 ; a := 0 ; for a1 from 1 to n do a := a+A129852rec([a1],n) ; od: RETURN(a) ; end: seq(A129852(n),n=1..20) ; # _R. J. Mathar_, Oct 31 2007

%p # second Maple program:

%p b:= proc(n, l, t) option remember; `if`(n=0, 1, add(

%p b(n-j, j, not t), j=`if`(t, l..n, 1..min(n, l))))

%p end:

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

%p seq(a(n), n=0..40); # _Alois P. Heinz_, May 23 2023

%t 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]]]}]];

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

%t Table[a[n], {n, 0, 40}] (* _Jean-François Alcover_, May 23 2023, after _Alois P. Heinz_ *)

%Y Cf. A129853.

%Y Cf. A025048, A025049.

%K nonn

%O 0,3

%A _Vladeta Jovovic_, May 22 2007

%E More terms from _R. J. Mathar_, Oct 31 2007

%E More terms from _Joerg Arndt_, May 21 2013

%E a(0)=1 prepended by _Alois P. Heinz_, May 23 2023