def out1(n) m = n/4 m.times.map{|i| i *= 4; [3+i, 1+i, 4+i, 2+i] }.flatten end def out3(n) out1(n).reverse end def out5(n) m = n/2 (1..m).zip((1..m).to_a.reverse).map{|x,y| [x, m+y]}.flatten end def out6(n) m = n/2 (1..m).zip(1..m).map{|x,y| [x, m+y]}.flatten end def out7(n) m = n/2 (1..m).zip(1..m).map{|x,y| [m+x, y]}.flatten end id = ARGV[0] || '1' n = 200000 aa = send('out' + id, n) p aa.size puts aa*' '