Here I convert the original number `a`

into its prime factorization list `digits`

. Then just check the overflow condition and whether there is a illegal digit.

```
class Solution(object):
def smallestFactorization(self, a):
"""
:type a: int
:rtype: int
"""
if a == 1: return 1
digits = []
for i in range(2, 10)[::-1]:
while not a % i:
a /= i
digits.append(str(i))
digits.reverse()
ans = int("".join(digits)) if digits else 0
return ans if -2147483648 <= ans <= 2147483647 and all(d <= '9' for d in digits) and a == 1 else 0
```