func dual_diagonal(n) { n.of {|k| var r = (k.of(0) + [1] + (n - k - 1).of(0)) r ~Z| r.reverse } } dual_diagonal(5).each{.join(' ').say}; say '' dual_diagonal(6).each{.join(' ').say}
1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1
Last updated 2 years ago