title: Python find sum of prime factors without loop
body: <p>I'm trying to produce the sum of all prime factors of a number without using loop. However if the result of prime_factor(m, k) bigger than 2, when go to main(n) after factor=prime_factor(m, k), factor will be None</p>
  
  <pre><code>def prime_factor(m, k):
      if m%k==0:
          return k 
      else:
          prime_factor(m, k+1)
  
  def main(n):
      if n&lt;2:
          return 0
      if n==2:
          return n
      else:
          factor=prime_factor(n, 2)
          return factor+main(n//factor)
  </code></pre>