Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def trial_prime_division(n):
- t = []
- p = 3
- if n%2 == 0:
- t.append(2)
- n //= 2
- while p*p <= n:
- while (n%p) == 0:
- t.append(p)
- n //= p
- p += 2
- if n > 1:
- t.append(n)
- return t
- print(trial_prime_division(15))
- print(trial_prime_division(21))
- print(trial_prime_division(493))
- print(trial_prime_division(540525642))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement