# RE: [R] Permutations

Date: Wed 14 Jul 2004 - 06:12:46 EST

I may be confused, but I think what you described will produce greater than 472 million permutations. I think your second permutation <1 2 4 | 3 5 6 | 7 8 9 | 10 11 12 YES-----2nd permutation> shows that you want more than just a permutation of entire blocks.

There are a total of 12! (12 factorial) permutations of 1:12 ignoring your blocking restriction.

There are 3! * 9! Permutations in which the first block has an intrablock permutation and the rest of the 9 symbols can do anything. Since there are 4 blocks then there are fewer than 4 * 3! * 9! permutations with intra-block transfers (this 4*3!*9! double counts some intrablock permutations - you need to take out of the 9! the count of intra-block only permutations among the remaining 9 symbols: 3!*3!*3!).

This gives more than
12! - 4*3!*9! + 1 = 9!*[12*11*10 - 4*3*2*1] + 1 = 12*9![110 - 2] + 1 ~ 472 million permutations.

How could you possibly deal with all of these permutations? If you can deal with this much junk then maybe you can generate all 12! Permutations and take out the ones you don't want.

Sorry if I got it totally wrong
bob

-----Original Message-----
From: Jordi Altirriba Gutiérrez [mailto:altirriba@hotmail.com] Sent: Tuesday, July 13, 2004 3:07 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Permutations

1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 ----------1st permutation

1 3 2 | 4 5 6 | 7 8 9 | 10 11 12 NO

Jordi Altirriba
Ph D student

Hospital Clinic - Barcelona - Spain

R-help@stat.math.ethz.ch mailing list