loading
open in
main.py
1
2
3
4
5
6
7
8
n = int(input('The largest prime factor of')) 
p = 2
while p*p <= n:      
  if n % p == 0: 
    n //= p
  else: 
    p+= 2 if p>2 else 1   # after 2, consider only odd p
print "is", n
Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.8.2] on linux