+ 1
Prime number check
https://code.sololearn.com/c59HnmxEt25C/# this is the most efficient way I could figure out to check if a number is prime, can this function be more optimized? Any advice?
2 odpowiedzi
0
But this will iterate more times ... why is it better ? CarrieForle
0
There are more advanced methods which are especially useful with very large numbers, and have rather complicated mathematical background, eg. Rabin-Miller.
Read more on wikipedia
https://en.m.wikipedia.org/wiki/Primality_test
https://en.m.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test