Question: How to create a sequence which depends on summation of previous terms

Each term of the following sequence is derived using the sum of all preceding terms following a simple algorithm. I have tried to code it but without success (keep getting error message "too many levels of recursion"). 

Definition is as follows:

a(0)=0, a(1)=1;  for n>=1,

a(n+2) = n + Sum{k=1..n+1} a(k). 
 

it starts: 0,1,2,5,11,23,47,95,191,767,1536,3071,6143...

(Looks like every prime term is of the form 3*2^m-1). 

Cann anyone suggest a solution?

Thanks,

David.

Please Wait...