fork download
  1. def fta( n ):
  2. i = 2
  3. while not (n == 1):
  4. fm = 0
  5. while n % i == 0:
  6. fm += 1
  7. n //= i
  8. if fm:
  9. print(f"{i} ^ {fm}")
  10. i += 1
  11.  
  12. def main():
  13. print("Fundamental Theorem of Arithmentic")
  14. n = int(input("N = "))
  15. fta( n )
  16. main()
Success #stdin #stdout 0.03s 9864KB
stdin
70
stdout
Fundamental Theorem of Arithmentic
N = 2 ^ 1
5 ^ 1
7 ^ 1