Smallest-value-after-replacing-with-sum-of-prime-factors||C++||Solution
Runtime: 3 ms, faster than 74.91% of C++ online submissions for Smallest Value After Replacing With Sum of Prime Factors.\nMemory Usage: 5.9 MB, less than 72.81
Runtime: 3 ms, faster than 74.91% of C++ online submissions for Smallest Value After Replacing With Sum of Prime Factors.\nMemory Usage: 5.9 MB, less than 72.81% of C++ online submissions for Smallest Value After Replacing With Sum of Prime Factors.\n```\n\nint prime(int num)\n{\n        int x=num;\n        int sum=0;\n        for(int i=2;x>1;i++)\n        {\n            while(x%i==0)\n            {\n                sum=sum+i;\n                x=x/i;\n            }\n        }\n        return sum;\n}\n\n\n\nclass Solution {\npublic:\n    int smallestValue(int n) \n    {\n        int sum=prime(n);\n        if(sum==n)\n        {\n            return sum;\n        }\n        else \n        {\n            return smallestValue(sum);\n        }\n        \n    }\n};\n```
['C']