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
```cpp []
class Solution {
public:
    int smallestValue(int n) {
        vector<int> div;
 int prev = n;

 for (int i = 2; true; i++)
 {
     if (n == i && div.empty())
         break;
     else if (n % i == 0)
     {
         div.push_back(i);
         n /= i;
         while (n % i == 0)
         {
             n /= i;
             div.push_back(i);
         }
         if (n == 1)
         {
             n = std::accumulate(div.begin(), div.end(), 0);
             div.clear();
             i = 1;
             if (n == prev)
                 break;
         }
     }
 }

 return n;
        }
};
```
['C++']