Printing index of the cyclic right shift
for ( l = 0 ; l < Math . floor ( N / 4 ) ; l ++ ) { document . write ( k + " " + ( k + 1 ) + " " + N + " " ) ; document . write ( k + 1 + " " + N + " " + ( N - 1 ) + " " ) ; k = k + 2 ; N = N - 2 ; } } else document . write ( " " ) ; }