Construct a prime circle - MATLAB Cody - MATLAB Central

Problem 46050. Construct a prime circle

Difficulty:Rate
A prime circle is a circular arrangement of the numbers 1 to 2n such that pairs of consecutive numbers add to primes. For example, if n = 3, a valid prime circle would be
1 6 5 2 3 4
because the sums of pairs would be 7, 11, 7, 5, 7, and (wrapping around) 5--all of which are prime.
Write a function to create a prime circle given n. The test suite will check that prime circle has the right numbers and that the sums of pairs are prime.

Solution Stats

31.61% Correct | 68.39% Incorrect
Last Solution submitted on Jun 19, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
2
3

Problem Recent Solvers39

Suggested Problems

More from this Author303

Problem Tags

Community Treasure Hunt

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

Start Hunting!