[Jprogramming] "Limited" Permutations
Raul Miller
rauldmiller at gmail.com
Thu Jun 21 23:02:11 HKT 2012
Here's one approach:
OTHER=: >,{;~1 -.~i.10
MASK=: (#~ 8=+/"1) #:i.2^10
,/MASK ([ + -.@[ #inv ])"1/ OTHER
--
Raul
On Thu, Jun 21, 2012 at 10:51 AM, David Vaughan <purpleblues13 at gmail.com> wrote:
> Hi, I'm trying to generate all permutations of length 10 with eight 1s and two other digits (not 1s).
> For example,
> 1 1 1 1 3 1 4 1 1 1
> 5 1 1 1 1 9 1 1 1 1
> ...
>
> Could anyone point me in the right direction?
>
> Many thanks.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list