[C++|Java|Python3] simulation
Please pull this commit for solutions of weekly 324. \n\nIntuition\nWe can simply repeatedly compute the sum of prime factors of each number and see where it en
Please pull this [commit](https://github.com/gaosanyong/leetcode/commit/af6e415cd101768ea8743ea9e4d22d788c9461c3) for solutions of weekly 324. \n\n**Intuition**\nWe can simply repeatedly compute the sum of prime factors of each number and see where it ends. \n**Implementation**\n**C++**\n```\nclass Solution {\npublic: \n\tint smallestValue(int n) {\n\t\twhile (true) {\n\t\t\tint sm = 0; \n\t\t\tfor (int f = 2, nn = n; f <= nn; ++f) \n\t\t\t\tfor (; nn % f == 0; nn /= f, sm += f); \n\t\t\tif (sm == n) break; \n\t\t\tn = sm;\n\t\t}\n\t\treturn n; \n\t}\n};\n```\n**Java**\n```\nclass Solution {\n\tpublic int smallestValue(int n) {\n\t\twhile (true) {\n\t\t\tint s = 0; \n\t\t\tfor (int f = 2, x = n; f <= x; ++f)\n\t\t\t\tfor (; x % f == 0; x /= f)\n\t\t\t\t\ts += f; \n\t\t\tif (s == n) break; \n\t\t\tn = s; \n\t\t}\n\t\treturn n; \n\t}\n}\n```\n**Python3**\n```\nclass Solution: \n\tdef smallestValue(self, n: int) -> int: \n\t\twhile True: \n\t\t\tnn, sm = n, 0\n\t\t\tfor f in range(2, nn+1): \n\t\t\t\twhile nn % f == 0: \n\t\t\t\t\tnn //= f \n\t\t\t\t\tsm += f\n\t\t\tif sm == n: break \n\t\t\tn = sm \n\t\treturn n\n```\n**Complexity**\nTime \nSpace O(1)
['C', 'Java', 'Python3']