killing_time_thread.py

import time
import threading


class MyThread(threading.Thread):
    def __init__(self, number):
        super().__init__()
        self.number = number

    def killing_time(self, number):
        return_list = []
        for i in range(1, number + 1):
            if number % i == 1:
                if i <= 9999:
                    return_list.append(i)
        return return_list

    def run(self):
        self.factors = list(self.killing_time(self.number))


start = time.time()
threads = []
num_list = [25000000, 20000000, 20076000, 14500000]
for n in num_list:
    thread = MyThread(n)
    thread.start()
    threads.append(thread)
for th in threads:
    th.join()
stop = time.time()
print('%.3f seconds' % (stop - start))