fork download
  1. def max_factor(num):
  2. """Find the maximum prime factor."""
  3. factor = 2
  4. while factor * factor <= num:
  5. while num % factor == 0:
  6. num /= factor
  7. factor += 1
  8. if (num > 1):
  9. return num
  10. return factor
  11.  
  12. print max_factor(8)
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
3