c++ || easy solution using prime factarization and seive
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\nint n=1e5;\nvector<int> prime(n,0);\nclass Solution {\npublic:\nvoid fun(){\nfor(int i=2;i*i<n;i++){\n    if(prime[i]==0){\nfor(int j=i*i;j<n;j+=i){\n   prime[j]=1;\n}\n    }\n}\n}\nint primefactor(int n){\n int sum=0;\n           for(int i=2;i<=sqrt(n);i++){\n            while(n%i==0){\n                sum+=i;\n                n/=i;\n            }\n          }\n          if(n>1) \n           sum+=n;\n          \n         \n          return sum;\n}\n\n    int smallestValue(int n) {\n          int sum=0;\n          fun();\n      while(1){\n        sum=primefactor(n);\n       if(prime[sum]==0) return sum;\n       if(n==sum) break;\n       n=sum;\n      }\n      \n      return n;\n    }\n};\n```
['C++']