JavaScript easy
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```\n/**\n * @param {number} n\n * @return {number}\n */\nvar smallestValue = function(n) {\n    let s=(primeFactors(n))\n    if(s==n){\n        return s\n    }\n   while(true){\n       let nn=primeFactors(n)\n       if(nn==n){\n           return n\n       }\n       n=nn\n   }\n    \n    return 0\n    \n    \n};\n\nfunction primeFactors(n)\n{\n    let ans=0\n    let c = 2;\n    while(n > 1)\n    {\n        if(n % c == 0){\n            ans+=c\n            n /= c;\n        }\n        else c++;\n    }\n    return ans\n}\n```
['JavaScript']