Question: Write using R code. Refer to the image. Problem 2 . Assume you have a function check.prime that can be used to check whether a
Write using R code. Refer to the image. Problem Assume you have a function check.prime that can be used to check whether
a given natural number is a prime. Modify your own code or one of mine posted in the
solution of homework
a Based on the function check.prime, create a new function that can count the number
of primes smaller than or equal to the given natural number. Name this new function
count.prime.
b Consider a sequence : Let be a vector with the same length as
and the th element of ic is the count of prime numbers up to the th clement
of ie Define Display the last values of and For
example, you can use the command tail cbind
c Plot versus On the same figure, add a curve versus Distinguish the two
curves with different line types and colors. Add legend too. In a separate figure, plot
versus Make comments on the relationship between and when is large.
Search "Prime number theorem" for reference to help make your comments.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
