Cody

Problem 46594. Create a sequence of primes p such that p > n π(p)

Solution 3032872

Submitted on 2 Oct 2020 by James
• Size: 43
• 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.

Test Suite

Test Status Code Input and Output
1   Pass
n = 1; p_correct = 2; assert(isequal(GTnPrimePi(n),p_correct))

2   Pass
n = 2; p_correct = 11; assert(isequal(GTnPrimePi(n),p_correct))

3   Pass
n = 3; p_correct = 37; assert(isequal(GTnPrimePi(n),p_correct))

4   Pass
n = 6; p_correct = 1087; assert(isequal(GTnPrimePi(n),p_correct))

5   Pass
n = 10; p_correct = 64553; assert(isequal(GTnPrimePi(n),p_correct))

6   Pass
n = 15; p_correct = 9558533; assert(isequal(GTnPrimePi(n),p_correct))

7   Pass
n = 20; p_correct = 1394193607; assert(isequal(GTnPrimePi(n),p_correct))

8   Pass
n = 18; d = num2str(GTnPrimePi(n))-'0'; assert(isequal(sum(d),50) && isequal(prod(d),349920))

Community Treasure Hunt

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

Start Hunting!