How many bit strings exist of length ten or less, not counting the empty string?

332 Views Asked by At

My understanding is that for bit string of length $n$ there are $2^n$ bit strings. So the sum of all bit strings of lengths $1$ to $10$ would be $2^1$+$2^2$+ ... +$2^{10}$ = $2^{55}$. The empty string is length $0$.

The professor said the answer was $2046$ with no additional feedback. What am I missing in my approach?

2

There are 2 best solutions below

1
On

It is true that $1 + 2 + \cdots + 10= 55$, but it is not true that $2^1 + 2^2 + \cdots + 2^{10}=2^{55}$. However, $2^1 + 2^2 + \cdots +2^{10}=2046$.

There's a general formula: $\sum_0^n 2^i = 2^{n+1} -1$, so $\sum_a^b 2^i = 2^{b+1}-2^a$.

1
On

$2^1+2^2+ ... +2^{10}$ is not $2^{55}$ ( you should not add the Powers )
It is $2^{11}-1-1$ which is $2046$

You can check that with these simpler cases :
$2^1+2^2$ is $2^{3}-1-1$ which is $6$ , we get same with $2+4$
$2^1+2^2+2^3$ is $2^{4}-1-1$ which is $14$ , we get same with $2+4+8$
$2^1+2^2+2^3+2^4$ is $2^5-1-1$ which is $30$ , we get same with $2+4+8+16$
$2^1+2^2+2^3+2^4+2^5$ is $2^6-1-1$ which is $62$ , we get same with $2+4+8+16+32$

To get the formula , look into geometric Series.