Cody

Problem 46117. Test approximations of the prime counting function

Solution 2808358

Submitted on 7 Aug 2020 by William
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
n = 1e2; r1_correct = 0.86859; r2_correct = 1.16324; [r1,r2] = primeCount(n); assert(isequal(round(r1,5),r1_correct) && isequal(round(r2,5),r2_correct))

2   Pass
n = 1e4; r1_correct = 0.88343; r2_correct = 1.01309; [r1,r2] = primeCount(n); assert(isequal(round(r1,5),r1_correct) && isequal(round(r2,5),r2_correct))

3   Pass
n = 1e6; r1_correct = 0.92209; r2_correct = 1.00164; [r1,r2] = primeCount(n); assert(isequal(round(r1,5),r1_correct) && isequal(round(r2,5),r2_correct))

4   Pass
n = 1e8; r1_correct = 0.94224; r2_correct = 1.00013; [r1,r2] = primeCount(n); assert(isequal(round(r1,5),r1_correct) && isequal(round(r2,5),r2_correct))

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!