How to prove that all powers of two minus one have only 1's when in binary representation?

71 Views Asked by At

It just came to my mind that all powers of two, when represented in binary format, are composed of only 1's, not 0's. I can see some logic behind it, however I can't seem to come up with an actual proof of that.

1: 1

3: 11

7: 111

15: 1111

31: 11111