Counting number of `1` digits in the value of \$11^n\$
You should put your programming skills aside for a bit and think. Think mathematically, what it actually means.

$$ 11^n = (10+1)^n $$

Lets say a=10, b=1 => \$(a+b)^n\$, this can be expanded using pascal triangle:

   1
  1 1
 1 2 1
1 3 3 1
...


I suppose everybody knows how this continues...

It then goes like this:

$$ (a+b)^n = {n \choose 0} a^n b^0 + {n \choose 1} a^{n-1} b^1 + \dots + {n \choose n} a^0 b^n $$

You can notice that since b=1 we can erase all those terms \$b^x\$

And we are left with
$$ (a+b)^n = {n \choose 0} a^n + {n \choose 1} a^{n-1} + \dots + {n \choose n} a^0 $$

Since a=10, we know \$a^n\$ is basically a 1 followed by n zeroes.

Simple add and carry of the coefficients should now show you when a digit is 1 and when it is anything else.