SHARE
TWEET

P.baow

a guest Oct 16th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from sys import exit
  2. div=[]
  3. num=int(input("Enter a positive integer greater than 1: "))
  4. if num<=1:
  5.     print("Input must be greater than 1")
  6.     exit()
  7. n=2
  8. k=num
  9. while True:
  10.     if num%n==0:
  11.         num=num/n
  12.         div.append(n)
  13.     else:
  14.         n=n+1
  15.     if n==k:
  16.         break
  17. if num!=1:
  18.     div.append(int(num))
  19. print(f"Prime factorization of {k} is:")
  20. div.sort()
  21. for i in div :
  22.     print(i)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top