Question: Writing procedures

Hi,

I've written the following procedure and seem to have completely forgotten how to code in Maple!!

> restart:
> p:=proc(n,int)
>   local k,s,i;
> for k from 2 to n do
> s[n]:= 2*sum(s[i]*s[n-i],i=1..n-2)+s[n-1]; end do:
> eval(s[n],n=k);
> end:
>
> p(2);p(3);p(4);p(5);p(10);
 

The above code yields results in terms of the expression s[i]. How do get my procedure to actually add it all up. For example p(10) should equal 103049? Many thanks.


          



 

Please Wait...