Sigma Notation Equation?

58 Views Asked by At

So I came across this post on stackoverflow which discussed the ranges of integer variables in C++. And the last point of the top-voted response was the unsigned long long int which apparently ranges from 0 to 18,446,744,073,709,551,615 (18.5 quintillion?). But that response did not mention what that would be equivalent to in bytes... Now I realize that there is obviously numerous other methods to figure this out, but what popped in my mind as a first thought is this:

$$\sum_{n=0}^{x}2^n = 18,446,744,073,709,551,615$$

Where x is the number of bits - 1. How would one go on about solving an equation like this? Sorry if it's something obvious, but no particular approach is coming to mind.

I already know that it's 8 bytes(x = 63)--the real topic here is equations that involve the Sigma Notation, and are they actually often seen in any fields of maths?

2

There are 2 best solutions below

0
On BEST ANSWER

You can use the finite geometric series formula

$$\sum_{n=0}^N x^n = \frac{1-x^{N+1}}{1-x}$$

In this case this has a simple form $2^{N+1}-1$, so then the equation is easily solved by taking logarithms.

0
On

Any scientific hand-held calculator will give you the answer: as $$\sum_{n=0}^x2^n=2^{x+1}-1,$$ you only have to solve $$x+1=\log_2(18\,446\,744\,073\,709\,551\,616)=64.$$