Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Factors of Integer is product of two primes
- # Juhani Kaukoranta 8.8.2019
- import math
- import time
- from numba import njit
- @njit
- def factor(n):
- for x in range(3, int(math.sqrt(n)) + 1,2):
- if n % x == 0:
- p = x
- q = n // x
- return [p,q]
- n = int(input("Anna kokonaisluku, jonka tulontekijät lasketaan: "))
- time0 = time.perf_counter() # timer begin
- print("tekijät = ",factor(n))
- time1 = time.perf_counter() # timer stop
- print("Aikaa kului ",time1 - time0," sekuntia")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement