simple C++ approach
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    \n    bool prime(int n){\n        if (n <= 1)\n        return false;\n \n    \n    for (int i = 2; i < n; i++)\n        if (n % i == 0)\n            return false;\n \n    return true;\n        \n    }\n    \n    int cal(int n){\n        \n       vector<int> vec;\n        \n        for(int i=2;i<n;i++){\n            // cout<<i;\n            if(prime(i) && n%i==0){\n                n=n/i;\n                vec.push_back(i);\n                i=1;\n                if(prime(n)) vec.push_back(n);\n            }\n            // cout<<n;\n            \n        }\n        \n        \n        int sum=0;\n        \n        for(auto i: vec) sum+=i;\n        vec.clear();\n        return sum;\n    }\n    \n    int smallestValue(int n) {\n        \n        cout<<"hi";\n        \n        while(!prime(n)){\n            if(n==4) return 4;\n            n=cal(n);\n            \n        }\n        \n        return n;\n    }\n};\n```
['C++']