| In case the graph theoretic formulation makes you scared of this problem,
here's the recreational math formulation:
Can you place the numbers from 1 to 2n in a circle so that each pair
of adjacent numbers sum to a prime?
For example, for n=4, we place the 8 numbers as follows:
1 - 2 - 3 - 8 - 5 - 6 - 7 - 4
[Note that 1+4 is required to be a prime too.]
Does anyone out there have an urge to create such a path for
various n? (Hamiltonian path algorithms can be found in
Nijenhuis and Wilf as well as various graph theory books, if you don't
feel like writing your own algorithm. A straightforward backtrack
algorithm should work too.)
|