Comment Comment by Pompidou the top comment trick [ n, 1, n + 1, 0 ][n % 4] can be implemented in J as following : f =: ]`1:`>:`0:@.(4&|)"0 Then: (,. ; #: ; [: #: f) i.16 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 2 0 0 1 0 0 0 1 1 3 0 0 1 1 0 0 0 0 4 0 1 0 0 0 1 0 0 5 0 1 0 1 0 0 0 1 6 0 1 1 0 0 1 1 1 7 0 1 1 1 0 0 0 0 8 1 0 0 0 1 0 0 0 9 1 0 0 1 0 0 0 1 .... parent Pompidou 1 year ago