The 2^m - 1 Binary Pattern Solution
IntuitionThe key insight comes from understanding how numbers with all 1's work in binary. When you have a number with m consecutive 1's in binary, it's equal t
# Intuition
The key insight comes from understanding how numbers with all 1's work in binary. When you have a number with m consecutive 1's in binary, it's equal to 2^m - 1. This is because:
For example with m=4 bits:

1111₂ = 2⁴ - 1 = 16 - 1 = 15₁₀
Breaking this down: 1111₂ = 2³ + 2² + 2¹ + 2⁰ = 8 + 4 + 2 + 1 = 15

So, if we need n 1's in our binary number, we need to find the smallest m where 2^m - 1 will give us a number with at least n 1's.

# Approach
1. First, we need to find how many bits (m) are needed to represent n 1's

* The relationship between n and m is: n ≤ m where 2^(m-1) < n+1 ≤ 2^m
* This can be solved using logarithms: m = ⌈log₂(n+1)⌉

2. Once we have m, our answer will be 2^m - 1

* This creates a binary number with exactly m consecutive 1's
* Which is guaranteed to be the smallest number with at least n 1's

For example, if n = 4:

1. m = ⌈log₂(5)⌉ = 3
2. 2^3 - 1 = 8 - 1 = 7 (111₂)

# Complexity
- Time complexity: $$O(1)$$
* Both logarithm and power operations are constant time
* No loops or iterations needed

- Space complexity: $$O(1)$$
* Only using a constant amount of extra space regardless of input size

# Code
```python3 []
class Solution:
    def smallestNumber(self, n: int) -> int:
        m = math.ceil(math.log2(n+1))
        return int(math.pow(2, m) - 1)
```
['Python3']