OFFSET
1,4
COMMENTS
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, section C1.
FORMULA
EXAMPLE
a(3) = 1, the arrangement is 1,3,6,2,4,5.
PROG
(MATLAB)
function D=primecirc(n)
tic
a = 2:2*n;
A=perms(a);
for i =1:factorial(2*n-1)
B(i, :)=[1 A(i, :)];
end
for k=1:size(B, 2)-1
F(:, k) = B(:, k)+B(:, k+1);
end
if k>1
F(:, k+1)=B(:, end)+B(:, 1);
end
l=1;
for i=1:factorial(2*n-1)
if ~isprime(F(i, :)) == ones(1, length(B(1, :)))
C(l, :)=B(i, :);
l=l+1;
end
end
if ~exist('C')
D=0;
return
end
if size(C, 1)==1
D=1;
else
D=size(C, 1)/2;
end
toc
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Bennett Gardiner, Jun 01 2011
EXTENSIONS
a(8)-a(15) from Max Alekseyev, Aug 19 2013
STATUS
approved