[Python3] Math solution with explanation
The main idea is the school formulas for the logarithm:


The first gives us the opportunity to get the sum of the logarithms of numbers, and the second to get
The main idea is the school formulas for the logarithm: 
1) ![image](https://assets.leetcode.com/users/images/c54c9f7a-a9e9-4b8d-86f7-f863da69bb4c_1678824195.7158313.png)
2) ![image](https://assets.leetcode.com/users/images/4b423b87-c359-4f0b-9924-4088850a054a_1678824253.0071406.png)


The first gives us the opportunity to get the sum of the logarithms of numbers, and the second to get the numbers themselves directly.
math.log(x) method returns the natural logarithm of a number, or the logarithm of number to base math.log(x, base).
Once there were about 15 testcases for this task and there were no problems with zeros. So now I had to add a couple of conditions for such cases.


```python []
class Solution:
    def getSum(self, a: int, b: int) -> int:
        if a == 0 and b != 0:
            return b
        elif b == 0 and a != 0:
            return a
        
        return int(log(exp(a) * exp(b)))
```

or even shorter:
```python []
class Solution:
    def getSum(self, a: int, b: int) -> int:
        return int(log(exp(a) * exp(b))) if a != 0 and b != 0 else a or b
```

**upd**: well, adding new test cases like a = 1000, b = 1 makes the above math solution irrelevant. We will either get an **overflow**, or get an error when we try to **logarithmize infinity**, or just get a **math range error**. So we have to change the **base of the logarithm** to fit the current constraints:

```python []
class Solution:
    def getSum(self, a: int, b: int) -> int:
        if a == 0 and b != 0:
            return b
        elif b == 0 and a != 0:
            return a
        
        return int(log2((2 ** a) * (2 ** b)))
```

shorter version:
```python []
class Solution:
    def getSum(self, a: int, b: int) -> int:
        return int(log2(2 ** a * 2 ** b)) if a != 0 and b != 0 else a or b
```
['Math', 'Python', 'Python3']