Easy solution
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def smallestValue(self, n: int) -> int:
        def fre(n):
            l=[]
            while n%2==0:
                l.append(2)
                n=n//2
            for i in range(3,int(n**0.5)+1,2):
                while n%i==0:
                    l.append(i)
                    n=n//i
            if n>2:
                l.append(n)
            k=sum(l)
            return k
        while True:
            f=fre(n)
            if f==n:
                break
            n=f
        return n
```
['Python3']