+ 2
What is the best algorithm for printing prime numbers
2 odpowiedzi
+ 2
The most understandable algorithm is to check if there are exactly 2 divisors of given number.
If you want fast algorithms, see https://stackoverflow.com/questions/453793/which-is-the-fastest-algorithm-to-find-prime-numbers and https://stackoverflow.com/questions/3808171/fast-algorithm-for-finding-prime-numbers?noredirect=1&lq=1
You can also watch ready algorithm written in C: https://www.tutorialspoint.com/learn_c_by_examples/prime_number_program_in_c.htm
You can also read comparison of different algorithms: https://www.researchgate.net/publication/331967146_COMPARISON_AMONG_DIFFERENT_PRIME_GENERATOR_ALGORITHMS
Another book: https://www.researchgate.net/publication/338363544_An_Algorithm_to_Generate_Largest_Prime_Number
There are many ways, so you can search in Google, Wikipedia, YouTube or other services.
+ 2
Tjanks