✔[C++] Simple Solution
Code\n\nclass Solution {\npublic:\n    int solve(int n){\n        if(n<=3) return n;\n        int sum=0;\n        for(int i=2; i<=n; i++){\n            while(n%
# Code\n```\nclass Solution {\npublic:\n    int solve(int n){\n        if(n<=3) return n;\n        int sum=0;\n        for(int i=2; i<=n; i++){\n            while(n%i == 0){\n                sum += i;\n                n = n/i;\n            }\n        }\n        return sum;\n    }\n    int smallestValue(int n) {\n        int result = solve(n);\n        while(true){\n            int ans = solve(result);\n            if(ans < result) result = ans;\n            else return result;\n        }\n        return 0;\n    }\n};\n```
['C++']