How to find a formula for the sum up to $n$ terms of the sum $1+11+111+11111...$ using $1+2x+3x^2+4x^3...$ I'm trying to find the formula for the sum up to $n$ terms of the sum $1+11+111+11111...$ using $1+2x+3x^2+4x^3...=\frac{1-x^n}{(1-x)^2}-\frac{nx^n}{1-x}$. It's easy to find the formula if we expressed the sum as $1+(1+10)+(1+10+100)+(1+10+100+1000)...$ however when I try to express the sum as $1+2x+3x^2+4x^3...$ I can't find a constant value for $x$. Can anyone guide me on how I can express $1+11+111+11111...$ as $1+2x+3x^2+4x^3...$.

$1 + 11 + 111 + .... = n + (n-1)10 + (n-2)10^2 + ....+2*10^{n-2} + 10^{n-1}$
$= 10^{n-1}(n*10^{-n} + (n-1)*10^{-n+1} + (n-2)10^{-n+2} + .....+2*10 +1)$
$= 10^{n-1}(1 + 2*\frac 1{10} + ..... + (n-2)*\frac 1{10} + (n-1))$
$= 10^{n-1}[\frac{1-\frac{1}{10}^n}{(1-\frac{1}{10})^2}-\frac{n\frac{1}{10}^n}{1-\frac{1}{10}}]$
