My Goal is to get summation from definition a[k] as below. I tried simple arithmetic progression 1,2,3,4,5.. . Although the function Sum returns symbolic result nicely, but my code doesn't. How to fix to get symbolic result to get 1/2 n (n+1) from a[k] definition?
Sum[i,{i,1,n}] (*1/2 n (n+1) *)(* Sum returns symbolic result*)
a[1]=1;
a[k_Integer?Positive]:=a[k-1]+1 (*definition of arithmetic progression *)
Assuming[Element[{k,n},Integers],Sum[a[k],{k,1,n}]] (*How to fix to get symbolic result 1/2 n (n+1*)



nthey do not give same value as theSum. $\endgroup$a[1]=1; a[k_Integer?Positive]:=k+a[k-1];and now they give same results for eachni.sstatic.net/A26q79F8.png You can also doa[k_Integer?Positive] := a[k] = k + a[k - 1];to speed it up. $\endgroup$