Cody

Problem 46060. Identify primorial primes

Solution 2751535

Submitted on 28 Jul 2020 by Tim
  • Size: 56
  • 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
x = 1; y_correct = -Inf; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

2   Pass
x = 2; y_correct = 0; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

3   Pass
x = 3; y_correct = 1; p_correct = 2; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

4   Pass
x = 5; y_correct = 1; p_correct = 6; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

5   Pass
x = 7; y_correct = 1; p_correct = 6; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

6   Pass
x = 13; y_correct = 0; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

7   Pass
x = 17; y_correct = 0; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

8   Pass
x = 29; y_correct = 1; p_correct = 30; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

9   Pass
x = 31; y_correct = 1; p_correct = 30; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

10   Pass
x = 61; y_correct = 0; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

11   Pass
x = 128; y_correct = -Inf; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

12   Pass
x = 211; y_correct = 1; p_correct = 210; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

13   Pass
x = 599; y_correct = 0; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

14   Pass
x = 2311; y_correct = 1; p_correct = 2310; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

15   Pass
x = 30029; y_correct = 1; p_correct = 30030; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

16   Pass
x = 999983; y_correct = 0; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

17   Pass
x = 142438007; y_correct = -Inf; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isnan(p))

18   Pass
x = 200560490131; y_correct = 1; p_correct = 200560490130; [y,p] = isPrimorialPrime(x); assert(isequal(y,y_correct) && isequal(p,p_correct))

Suggested Problems

More from this Author48

Community Treasure Hunt

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

Start Hunting!