archive or wiki did not help, but perhaps I searched wrong perm =: i.@! A. i.
~.@({~ [: perm #) 1 1 2 2 1 1 2 2 1 2 1 2 1 2 2 1 2 1 1 2 2 1 2 1 2 2 1 1 while that is the answer I want, and is short and elegant, it grows very innefficient as the length of the argument grows even if the answer is a short list. Is there an algorithm that can produce these "permutations with repeats" without the intermediate full permutation list? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm