1+11+111+1111+111...1
=1+(10+1)+(10^2+10+1)+(10^3+10^2+1)+...+[10^n+10^(n-1)+...1]
=1×n+10(n-1)+10^2(n-2)+...+10^n[n-(n-1)]
设Sn=1×n+10(n-1)+10^2(n-2)+...+10^n (1)
10sn=10+10^2(n-1)+10^3(n-2)+...+10^(n+1)n(2)
∴(1)-(2):
-9Sn=n+[10+10^2+10^3+10^n]-10^(n+1)n
-9Sn=n-10^(n+1)+{10[1-10^n]/(1-10)}
={n-10^(n+1)}-{10[1-10^n]/9}
∴Sn={-{n-10^(n+1)}/9}-{10[1-10^n]/81}
=10^(n+1)/9-(n/9)-{10[1-10^n]/81}