sum of prime numbers
class Solution(object): def minSteps(self, n): """ :type n: int :rtype: int """ #sum of prime numbers ans = 0 prime = 2 while n > 1: while n%prime == 0: ans += prime n /= prime prime += 1 return ans
Last updated 3 years ago
Was this helpful?