Cody

# Problem 46117. Test approximations of the prime counting function

Solution 3825948

Submitted on 24 Nov 2020 by David Hill
• Size: 41
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

### 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))

### Community Treasure Hunt

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

Start Hunting!