CodeDominar Solution
Code\n\nclass Solution:\n    def smallestValue(self, n: int) -> int:\n        def find_factors_sum(n):\n            sum_ = 0\n            for i in range(2,n):\n
# Code\n```\nclass Solution:\n    def smallestValue(self, n: int) -> int:\n        def find_factors_sum(n):\n            sum_ = 0\n            for i in range(2,n):\n                while n%i==0:\n                    sum_+=i\n                    n = n//i\n            return sum_\n        while find_factors_sum(n) and n!=find_factors_sum(n):\n            n = find_factors_sum(n)\n        return n\n            \n        \n                \n```
['Python3']