using prime factor
Intuition\nUsing prime factore\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity:\n Add your time complexity he
# Intuition\nUsing prime factore\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 {\n     public int smallestValue(int n) {\n        int x=n;\n        int sum=0,j=0;\n        if(n<=5){\n            return n;\n        }\n        // if(n==4) return \n        while(true){\n            int i=2;\n            sum=0;\n            while (n>1) {\n                if(n%i==0){\n                    sum+=i;\n                    n=n/i;\n                }\n                else i++;\n            }\n            n=sum;\n           if(sum==x) break;\n           else x=sum;\n        }\n        return x;\n    }\n}\n```
['Java']