If n is odd then every set will contain 2 adjacent element except the last set which will have last three elements
for ( let i = 0 ; i < Math . floor ( n / 2 ) - 1 ; i ++ ) { firstadj = 2 * i + 1 ; secadj = 2 * i + 2 ; document . write ( " " + firstadj + " " + secadj + " " + " " ) ; }