Question: Please use python to code Problem 2 Write a function num_primes (n) that returns the number of primes that are less than or equal to

Please use python to code Problem 2 Write a function num_primes (n)Please use python to code

Problem 2 Write a function num_primes (n) that returns the number of primes that are less than or equal to n. For instance num_primes (5) should return 3, since 2,3,5 are the primes that are less than or equal to 5. Do not use any bulit-in functions that have to do with primes (you are welcome to reuse the primality test function you wrote for a previous homework). Use it compute the ratio num_primes (n) for n = 10, 102, ..., 10%. Plot these ratios using the built-in list plot command (you will need to look up the syntax, since we haven't covered this). How do you think this ratio behaves as n

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!