Cody

Problem 44699. Prime Product

Solution 2122742

Submitted on 9 Feb 2020 by Asif Newaz
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 2 3]; y_correct = 2; assert(isequal(prime_product(x),y_correct))

a = 1 2 1 3 2 3 b = 2 3 6 c = 2 3

2   Pass
x = [5 2 5 2]; y_correct = -1; assert(isequal(prime_product(x),y_correct))

a = 5 2 5 5 5 2 2 5 2 2 5 2 b = 10 25 10 10 4 10 c = 0×1 empty double column vector

3   Pass
x = [1 63]; y_correct = -1; assert(isequal(prime_product(x),y_correct))

a = 1 63 b = 63 c = []

4   Pass
x = [ 3 6 234 1 623 234 ]; y_correct = 3; assert(isequal(prime_product(x),y_correct))

a = 3 6 3 234 3 1 3 623 3 234 6 234 6 1 6 623 6 234 234 1 234 623 234 234 1 623 1 234 623 234 b = 18 702 3 1869 702 1404 6 3738 1404 234 145782 54756 623 234 145782 c = 3

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!