login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A129853 Nonascending wiggly sums: number of sums adding to n in which terms alternately do not increase and do not decrease. 28

%I #22 Aug 16 2023 08:22:10

%S 1,1,2,3,6,9,17,28,50,85,149,257,448,775,1347,2336,4057,7038,12219,

%T 21204,36807,63880,110878,192442,334020,579739,1006237,1746482,

%U 3031310,5261324,9131892,15849876,27510049,47748159,82874713,143842547,249662173,433329337,752113633,1305415658,2265761441

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

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

%e 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.

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

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

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

%e 02: [ 1 1 1 1 2 ]

%e 03: [ 1 1 2 1 1 ]

%e 04: [ 1 1 2 2 ]

%e 05: [ 1 1 3 1 ]

%e 06: [ 1 1 4 ]

%e 07: [ 2 1 1 1 1 ]

%e 08: [ 2 1 2 1 ]

%e 09: [ 2 1 3 ]

%e 10: [ 2 2 2 ]

%e 11: [ 3 1 1 1 ]

%e 12: [ 3 1 2 ]

%e 13: [ 3 3 ]

%e 14: [ 4 1 1 ]

%e 15: [ 4 2 ]

%e 16: [ 5 1 ]

%e 17: [ 6 ]

%e (End)

%p 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

%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, 1, true):

%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, 1, True];

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

%Y Cf. A129852.

%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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 13:12 EDT 2024. Contains 371969 sequences. (Running on oeis4.)