While analyzing and understanding the code of prime factorization and the sieve of Eratosthenes using Google Colaboratory Editor, I thought that to speed up prime factorization, it would be faster to divide by a divisible number in advance than to divide by a prime number and then determine the prime number. This is because a "number" is itself made up of primes or composite numbers that are made by multiplying prime numbers together. Therefore, I thought it would be better to create a table of prime numbers first and then divide by that number.
The graph below summarizes the time taken to "prime factorize" the 24 in the code we have done this time, and the reason we did it five times is that there is an error in the time each time it is done, so we needed to take the time in between. The bar graph shows the information from the previous step plus the average.
From this graph, comparing No. 1 and No. 2 in terms of average speed after 5 random runs, we can see that No. 2 is faster. However, we noticed that there are still a lot of random elements, and we cannot completely prove that No. 2 is faster, which is a shortcoming of this study.On the other hand, I discovered that the code I tried this time retains 0.000... time and becomes faster.