mfgnik

Untitled

Jun 12th, 2020
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def find_radical(n):
  2.     p = []
  3.     d = 2
  4.     rad = 1
  5.     while d * d <= n:
  6.         cnt = 0
  7.         while n % d == 0:
  8.             cnt += 1
  9.             n //= d
  10.         if cnt != 0:
  11.             rad *= d
  12.         d += 1
  13.     if n > 1:
  14.         rad *= n
  15.     return rad
  16.  
  17.  
  18. number = int(input())
  19. radical = find_radical(number)
  20. for i in range(1, 30):
  21.     x = i * radical
  22.     if pow(x, x, number) == 0:
  23.         print(i * radical)
  24.         break
Advertisement
Add Comment
Please, Sign In to add comment