In a Udacity course I'm told the following: $\sum_{i=1}^{\log_2 (P)} 1/2^i = (P-1) /P $
I've checked that it's true by entering it into Wolfram Alpha: https://www.wolframalpha.com/input/?i=sum+1%2F2^n,+n%3D1+to+log%282,P%29
Could someone help me understand how the $ (P-1)/ P $ result is derived?