%I #30 Feb 18 2020 14:28:05
%S 1,0,1,1,0,6,3,42,68,2794,0,5311604,478,57009,2716452,10778632,207360,
%T 39187872956340,106144,26869397610,11775466120,22062519153360,
%U 559350576,29991180449906858400,257272815600,12675330087321600,52248156883498208
%N Number of permutations i_0, i_1, ..., i_n of 0, 1, ..., n with i_0 = 0 and i_n = n such that the n+1 numbers i_0^2+i_1, i_1^2+i_2, ..., i_{n-1}^2+i_n, i_n^2+i_0 are all relatively prime to both n-1 and n+1.
%C Conjecture: a(n) > 0 except for n = 2, 5, 11. Similarly, for any positive integer n not equal to 4, there is a permutation i_0, i_1, ..., i_n of 0, 1, ..., n with i_0 = 0 and i_n = n such that the n+1 numbers i_0^2-i_1, i_1^2-i_2, ..., i_{n-1}^2-i_n, i_n^2-i_0 are all coprime to both n-1 and n+1.
%C Zhi-Wei Sun also made the following general conjecture:
%C For any positive integer k, define E(k) to be the set of those positive integers n for which there is no permutation i_0, i_1, ..., i_n of 0, 1, ..., n with i_0 = 0 and i_n = n such that all the n+1 numbers i_0^k+i_1, i_1^k+i_2, ..., i_{n-1}^k+i_n, i_n^k+i_0 are coprime to both n-1 and n+1. Then E(k) is always finite; in particular, E(1) = {2,4}, E(2) = {2,5,11} and E(3) = {2,4}.
%H Zhi-Wei Sun, <a href="/A229130/a229130.txt">List of required permutations for n = 1..10</a>
%H Zhi-Wei Sun, <a href="http://arxiv.org/abs/1309.1679">Some new problems in additive combinatorics</a>, preprint, arXiv:1309.1679 [math.NT], 2013-2014.
%e a(3) = 1 due to the permutation (i_0,i_1,i_2,i_3)=(0,1,2,3).
%e a(4) = 1 due to the permutation (0,1,3,2,4).
%e a(6) = 1 due to the permutations
%e (0,1,3,2,5,4,6), (0,1,3,4,2,5,6), (0,2,5,1,3,4,6),
%e (0,3,2,4,1,5,6), (0,3,4,1,2,5,6), (0,4,1,3,2,5,6).
%e a(7) = 3 due to the permutations
%e (0,1,6,5,4,3,2,7), (0,5,4,3,2,1,6,7), (0,5,6,1,4,3,2,7).
%e a(8) > 0 due to the permutation (0,2,1,4,6,5,7,3,8).
%e a(9) > 0 due to the permutation (0,1,2,3,4,5,6,7,8,9).
%e a(10) > 0 due to the permutation (0,1,3,5,4,7,9,8,6,2,10).
%e a(11) = 0 since 6 is the unique i among 0,...,11 with i^2+5 coprime to 11^2-1, and it is also the unique j among 1,...,10 with j^2+11 coprime to 11^2-1.
%t (* A program to compute required permutations for n = 8. *)
%t V[i_]:=Part[Permutations[{1,2,3,4,5,6,7}],i]
%t m=0
%t Do[Do[If[GCD[If[j==0,0,Part[V[i],j]]^2+If[j<7,Part[V[i],j+1],8], 8^2-1]>1,Goto[aa]],{j,0,7}];
%t m=m+1;Print[m,":"," ",0," ",Part[V[i],1]," ",Part[V[i],2]," ",Part[V[i],3]," ",Part[V[i],4]," ",Part[V[i],5]," ",Part[V[i],6]," ",Part[V[i],7]," ",8];Label[aa];Continue,{i,1,7!}]
%Y Cf. A228886, A229082, A229038, A229005, A228917, A228956.
%K nonn,hard
%O 1,6
%A _Zhi-Wei Sun_, Sep 15 2013
%E a(12)-a(17) from _Alois P. Heinz_, Sep 15 2013
%E a(19) and a(23) from _Alois P. Heinz_, Sep 16 2013
%E a(18), a(20)-a(22) and a(24)-a(27) from _Bert Dobbelaere_, Feb 18 2020