Advertisement
Guest User

Untitled

a guest
May 12th, 2013
5,591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #!/usr/bin/python
  2. # xisk - May 2013
  3. # Python 2.7.3
  4. # License: Creative Commons BY-ND 3.0
  5.  
  6. def lpf(x):
  7.     lpf = 2;
  8.     while (x > lpf):
  9.         if (x%lpf==0):
  10.             x = x/lpf
  11.             lpf = 2
  12.         else:
  13.             lpf+=1;
  14.     print("Largest Prime Factor: %d" % (lpf));
  15.  
  16. def main():
  17.     x = long(raw_input("Input long int:"))
  18.     lpf(x);
  19.     return 0;
  20.  
  21. if __name__ == '__main__':
  22.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement