Created
August 26, 2020 19:24
-
-
Save abecus/5129fdcce52add1cf5e3ba0062e5739a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gammaTrialMethod(n): | |
gamma = 1 | |
count = 0 | |
while n % 2 == 0: | |
count += 1 | |
n = n // 2 | |
gamma *= pow(2, ceil(count / 2)) | |
for i in range(3, ceil(math.sqrt(n)) + 1, 2): | |
count = 0 | |
while n % i== 0: | |
count += 1 | |
n = n // i | |
gamma *= pow(i, ceil(count / 2)) | |
if n > 2: | |
gamma *= n | |
return gamma |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment