Created
November 7, 2015 07:31
-
-
Save knuu/936895147d131b2dc5ba to your computer and use it in GitHub Desktop.
SRM 643 div.2 500 / div.1 250 TheKingsFactorization
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
# -*- coding: utf-8 -*- | |
import math,string,itertools,fractions,heapq,collections,re,array,bisect | |
class TheKingsFactorization: | |
def getVector(self, N, primes): | |
ans = list(primes) | |
n = N | |
for p in primes: | |
n /= p | |
i = 2 | |
while i ** 3 <= N: | |
while n % i == 0: | |
n /= i | |
ans.append(i) | |
i += 1 | |
if n > 1: | |
ans.append(n) | |
return tuple(sorted(ans)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment