n=n
cn=n/2^n
Tn=1/2+2/2^2+3/2^3+...+(n-1)/2^(n-1)+n/2^n
2Tn=1+2/2+3/2^2+4/2^3+.+n/2^(n-1)
2Tn-Tn=1+1/2+1/2^2+1/2^3+...+1/2^(n-1)-n/2^n
Tn=2-2^(1-n)-n/2^n
=2-(n+2)/2^n
n=n
cn=n/2^n
Tn=1/2+2/2^2+3/2^3+...+(n-1)/2^(n-1)+n/2^n
2Tn=1+2/2+3/2^2+4/2^3+.+n/2^(n-1)
2Tn-Tn=1+1/2+1/2^2+1/2^3+...+1/2^(n-1)-n/2^n
Tn=2-2^(1-n)-n/2^n
=2-(n+2)/2^n