Simple || C++
 # Intuition\n<!-- Describe your first thoughts on how to solve this problem.  \n\n\n\n\n\n\n\n \n\n# Code\n\nclass Solution {\npublic:\n    int primeFactorsFin
<!-- # 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:\nAdd your space complexity here, e.g. $$O(n)$$ --> \n\n# Code\n```\nclass Solution {\npublic:\n    int primeFactorsFind(int n)\n    {\n        int newNum=0;\n        while (n % 2 == 0)\n        {\n            newNum += 2;\n            n = n/2;\n        }\n\n       \n        for (int i = 3; i <= sqrt(n); i = i + 2)\n        {\n           \n            while (n % i == 0)\n            {\n                 newNum += i;\n                n = n/i;\n            }\n        }\n\n        if (n > 2)\n            newNum += n;\n        return newNum;\n    }\n    \n    bool isPrimeNum(int n)\n    {\n        \n        for (int i = 2; i * i <= n; i++) {\n            if (n % i == 0)\n                return false;\n        }\n        return true;\n    }\n    \n    int smallestValue(int n) {\n        \n        unordered_set<int> st;\n        \n        while(1){\n            \n            st.insert(n);\n            \n            //checking wheteher n is prime or not\n            if(isPrimeNum(n))   \n                return n;\n            \n            //finding sum of it\'s prime factors\n            n = primeFactorsFind(n);\n            \n            //checking whether value of n is repeating or not\n            if(st.find(n) != st.end()){\n                return n;\n            }\n            \n        }\n        return n;\n    }\n};\n\n```
['C++']