Easy  Understandable  Solution [c++]
Code\n\nclass Solution {\npublic:\n    int smallestValue(int n) {\n        int k=2;\n        int sum=0;\n        int maxi=n;\n        int mini=n;\n        while
# Code\n```\nclass Solution {\npublic:\n    int smallestValue(int n) {\n        int k=2;\n        int sum=0;\n        int maxi=n;\n        int mini=n;\n        while(true){\n            if(n%k==0){\n                sum+=k;\n                n=n/k;\n            }\n            else k++;\n            if(n==1){\n                if(sum==maxi) break;\n                n=sum;\n                sum=0;\n                mini=min(n,mini);\n                k=2;\n                maxi=n;\n            }\n            \n        }\n        return mini;\n    }\n};\n```
['C++']