How to find prime numbers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to find prime numbers?

this is very important

12th Dec 2017, 2:18 PM
Lasath Randika
Lasath Randika - avatar
5 Answers
+ 2
Check out the function isPrime in this code: https://code.sololearn.com/cJ1rV8PUIzC3/?ref=app
12th Dec 2017, 2:48 PM
DAB
DAB - avatar
0
https://en.m.wikipedia.org/wiki/Prime_number
12th Dec 2017, 2:31 PM
Gunther Strauss
Gunther Strauss - avatar
0
https://rosettacode.org/wiki/Miller–Rabin_primality_test#Ada
12th Dec 2017, 2:42 PM
Gunther Strauss
Gunther Strauss - avatar
- 1
Like this up to n<4759123141 DeterministiccMiller-Rabin test - for low Ns only 3 tests are needed. You cant be faster. https://code.sololearn.com/cZo7y4VVqSJJ/?ref=app
30th Dec 2017, 9:06 PM
VcC
VcC - avatar
- 1
Also look at this one to find prime factors https://code.sololearn.com/cU9K9ia897vz/?ref=app
30th Dec 2017, 10:00 PM
VcC
VcC - avatar