Let $n>1$ be an integer. Consider the set $C_n := \{0,1, \dots , n-1\}$.    

An *Eulerian ordering* of $C_n$ is an ordering $r_1, \dots, r_n$ of its elements such that:   
$$\forall i \le n \ \forall j<i \ \exists k < i \text{ with } \frac{n}{gcd(n,r_i-r_k)} \text{ prime and } \frac{gcd(n,r_i-r_k)}{gcd(n,r_i-r_j)} \text{ integer.}$$  

*Remark*: Let $p$ be a prime number. Then, $0,1, \dots , p-1$ is an Eulerian ordering of $C_p$.   
In fact, any ordering of $C_p$ is Eulerian, so that $C_p$ has $p!$ Eulerian orderings.  

*Exercice*: If $n$ is not square-free then $C_n$ has no Eulerian ordering.

Example:  the (lexicographically first) Eulerian ordering for $C_n$ with $n \le 30$ square-free non-prime:      
$C_6 : 0,2,3,1,4,5$   
$C_{10} : 0, 2, 4, 5, 1, 3, 6, 7, 8, 9$  
$C_{14} : 0, 2, 4, 6, 7, 1, 3, 5, 8, 9, 10, 11, 12, 13$  
$C_{15} : 0, 3, 5, 2, 6, 1, 4, 7, 8, 9, 10, 11, 12, 13, 14$   
$C_{21} : 0, 3, 6, 7, 1, 4, 8, 2, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20$  
$C_{22} : 0, 2, 4, 6, 8, 10, 11, 1, 3, 5, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21$  
$C_{26} : 0,  2,  4,  6,  8,  10,  12,  13,  1,  3,  5,  7,  9,  11,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25$  
$C_{30} : 0,  6,  10,  4,  12,  2,  8,  14,  15,  16,  18,  3,  20,  5,  17,  21,  1,  7,  11,  13,  19,  9,  22,  23,  24,  25,  26,  27,  28,  29$ 
      


**Main question**: Is there an Eulerian ordering of $C_n$, for every $n>1$ square-free?      
It is checked by Sage for $n\le 200$ (see below).
  

If yes, let $n>1$ be a square-free integer:  
*Stronger question*: Can any partial Eulerian ordering of $C_n$ ($r_1, \dots, r_s$ with $s<n$) be completed?    
*Bonus question*: How many Eulerian orderings of $C_n$ are there?    

___
*Sage program*  

    # %attach SAGE/IntegerOrder.spyx
    
    from sage.all import *
    
    cpdef IntegerOrder(int n):
    	cdef int s,i,j,k,a,b,c,g1,g2,p
    	cdef list L,T
    	T=range(n)
    	L=[0]
    	T.remove(0)
    	for s in range(n-1):
    		c=0
    		for i in T:
    			a=0
    			for j in L:
    				b=0
    				for k in L:
    					g1=gcd(n,i-k)
    					g2=gcd(n,i-j)
    					p=n/g1
    					if is_prime(p) and g1 % g2 ==0:
    						b=1
    						break	
    				if b==0:
    					a=1
    					break
    			if a==0:
    				L.append(i)
    				T.remove(i)
    				c=1
    				break	
    		if c==0:
    			break
    	return L
    
    cpdef TestSquareFree(int r1, int r2):
    	cdef int n,l
    	cdef list L
    	for n in range(r1,r2+1):
    		if is_squarefree(n) and not is_prime(n):
    			L=IntegerOrder(n)
    			l=len(L)
    			if l<n:
    				return n
    	return True


*Computation*

    sage: IntegerOrder(22)
    [0, 2, 4, 6, 8, 10, 11, 1, 3, 5, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
    sage: TestSquareFree(2,200)
    True

    sage: IntegerOrder(210)
    [0, 30, 42, 12, 54, 24, 60, 18, 48, 6, 36, 66, 70, 72, 2, 78, 84, 90, 96, 100, 102, 32, 105, 108, 112, 82, 40, 114, 44, 14, 74, 120, 15, 124, 4, 88, 28, 58, 94, 10, 52, 98, 8, 38, 50, 20, 62, 80, 92, 22, 64, 104, 34, 76, 16, 46, 86, 26, 56, 68, 106, 110, 116, 118, 122, 126, 21, 111, 128, 130, 132, 27, 117, 134, 135, 9, 129, 3, 123, 136, 138, 33, 140, 35, 141, 1, 142, 144, 39, 146, 147, 148, 150, 45, 152, 153, 154, 155, 156, 51, 121, 158, 159, 160, 161, 41, 71, 125, 162, 57, 127, 7, 37, 91, 164, 165, 166, 167, 47, 5, 75, 77, 107, 65, 131, 61, 19, 49, 79, 109, 25, 55, 13, 43, 85, 97, 103, 113, 23, 53, 11, 81, 83, 93, 95, 115, 31, 73, 119, 29, 59, 17, 87, 89, 99, 101, 133, 63, 137, 67, 139, 69, 143, 145, 149, 151, 157, 163, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209]