Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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) 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 nStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started