New life from now

02 July, 2010

算法之美:求一个数n的最大质因数(Python)

n=600851475143
d=2
while d < n/d:
    if n%d==0:
        n/=d
    else:
        d+=1
print n
Posted by Lawrence at 16:30 0 comments
Labels: algorithm
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ►  2011 (1)
    • ►  March (1)
  • ▼  2010 (31)
    • ►  November (1)
    • ►  August (1)
    • ▼  July (1)
      • 算法之美:求一个数n的最大质因数(Python)
    • ►  April (2)
    • ►  March (3)
    • ►  February (4)
    • ►  January (19)
  • ►  2007 (1)
    • ►  February (1)

About Me

Lawrence
View my complete profile

My Douban

Powered by Blogger.