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:[EMAIL PROTECTED] Sent: Tuesday, July 13, 2004 3:07 PM To: [EMAIL PROTECTED] Subject: [R] Permutations Dear R users, I'm a beginner user of R and I've a problem with permutations that I don't know how to solve. I've 12 elements in blocks of 3 elements and I want only to make permutations inter-blocks (no intra-blocks) (sorry if the terminology is not accurate), something similar to: 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 - - 3 2 1 | 4 5 6 | 7 8 9 | 10 11 12 NO - - - 1 2 4 | 3 5 6 | 7 8 9 | 10 11 12 YES-----2nd permutation - - 4 5 6 | 1 2 3 | 7 8 9 | 10 11 12 YES-----3rd permutation - - - - - - 4 5 6 | 2 1 3 | 7 8 9 | 10 11 12 NO - - .... Thanks for your time, Jordi Altirriba Ph D student Hospital Clinic - Barcelona - Spain MSN Motor. http://motor.msn.es/researchcentre/ ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html