The question is from Pui Ching Invitational Mathematics Competition (2019)
My attempt:
obvious solution (symmetric form is omitted)
$(0,1,2,3,...,n,0)$ [difference: $1 \& n$]
$(0,1,3,5,...,2m-1,2m,2m-2,...,0)$ [difference: $1 \& 2$]
$(0,2m-1,2m-3,...,1,2m,2m-2,...,0)$ [difference: $2 \& 2m-1$]
$(0,1,3,...,2m+1,2m,...,2,0)$[difference: $1 \& 2$]
$(0,m+1,1,m+2,2,...,2m,m,0)$ [difference: $m \& m+1$]
ex: if $n = 6$
$(0,1,2,3,4,5,6,0)$ [difference: $1 \& 6$]
$(0,1,3,5,6,4,2,0)$ [difference: $1 \& 2$]
$(0,5,3,1,6,4,2,0)$ [difference: $2 \& 5$]
$(0,4,1,5,2,6,3,0)$ [difference: $3 \& 4$]
In addition to general solutions, I found that if $n = 12$, other permutations exist:
$(0,3,1,4,6,8,11,9,12,10,7,5,2,0)$ [difference: $2 \& 3$]
$(0,9,5,1,10,6,2,11,7,3,12,8,4,0)$ [difference: $4 \& 9$]
Is there an algorithm to construct all possible permutations, or a formula to calculate the ways for any $n$? Thank you very much.
