BehrangDBA
asked on
Writing a function to counts the number of primes in the range [1-N].
Hi everyone,
How can I write a function that counts the number of primes in the range [1-N].
(A natural number is called a prime, a prime number or just prime if it has exactly two distinct divisors. Therefore, 1 is not prime number, since it has only one divisor, namely 1.)
How can I write a function that counts the number of primes in the range [1-N].
(A natural number is called a prime, a prime number or just prime if it has exactly two distinct divisors. Therefore, 1 is not prime number, since it has only one divisor, namely 1.)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi BehrangDBA,
Did you get a chance to check this?
Regards,
Pawan
Did you get a chance to check this?
Regards,
Pawan
ASKER
Thank you very much for your time Pawan.
Open in new window
if you list of primes use below
Open in new window
Output
------------------------
PrimeNumbers
-------------------------
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47