Saturday, December 4, 2010

Cheating, sorta

What is the largest prime factor of the number 600851475143 ?

from os import system
from os.path import isfile
from sys import argv

try:
import numbthy
except:
if not isfile("numbthy.py"): # don't mess with it if it's already there and broken
system("wget http://userpages.umbc.edu/~rcampbel/Computers/Python/lib/numb
thy.py")
import numbthy

f = numbthy.factors(int(argv[1]))
if f: print f[-1]

No comments: