Cody

# Problem 46050. Construct a prime circle

Solution 2723523

Submitted on 21 Jul 2020 by Tim
• Size: 48
• 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 = 2; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

2   Pass
n = 3; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

3   Pass
n = 4; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

4   Pass
n = 5; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

5   Pass
n = 10; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

6   Pass
n = 25; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

7   Pass
n = 100; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

8   Pass
n = 250; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

9   Pass
n = 500; y = primeCircle(n); assert(isequal(sort(y),1:2*n) && all(isprime([y(1:end-1)+y(2:end) y(1)+y(end)])))

### Community Treasure Hunt

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

Start Hunting!