Simplest Easiest Solution C++
\n    int smallestValue(int n)\n    {\n\n        int sum = 0;\n        bool flag = false;\n        int i = 2;\n        while (i <= n / 2)\n        {\n          
\n    int smallestValue(int n)\n    {\n\n        int sum = 0;\n        bool flag = false;\n        int i = 2;\n        while (i <= n / 2)\n        {\n            if (n % i == 0)\n            {\n                sum += i;\n                flag = true;\n                n /= i;\n                continue;\n            }\n            i++;\n        }\n        if (n != 1 && flag == 1)\n        {\n            sum += n;\n        }\n        if (n == 2 && sum == 4)\n        {\n            return sum;\n        }\n        if (flag == 0)\n        {\n            return n;\n        }\n        return smallestValue(sum);\n    }\n
['Math', 'Recursion', 'C']