cheeeesy

Untitled

Jun 28th, 2020
122
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def ch(n):
  2.  
  3.     check = type(n)
  4.     if check in [int, float, complex]:
  5.         if check is not int or n < 1:
  6.             raise ValueError
  7.     else:
  8.         raise TypeError
  9.  
  10.     # Это факторизация целых чисел
  11.  
  12.     i = 2
  13.     primfac = []
  14.     while i * i <= n:
  15.         while n % i == 0:
  16.             primfac.append(i)
  17.             n = n / i
  18.         i = i + 1
  19.     if n > 1:
  20.         primfac.append(int(n))
  21.     return primfac
  22.  
  23.  
  24. print(ch(123))
RAW Paste Data