Generating all possible combination of elements in a list

Mir Nazim mirnazim at gmail.com
Tue Jul 25 15:10:19 EDT 2006


> Again, I don't understand. You have 924 things, eliminate some of them,
> and end up with 1060 things? Eliminating elements should decrease
> the number, not increase it.

yes, u are right I had to types of lists:

one one them has 924 permutations and other has 792 making them 1722.
out of which only 1060 are permissible permutations

>
> > Now I ahave a lits with 1060 lists in it. Now comes the hard part.
> > How many possible distinct ways are there to arrange 1060 elements
> > taken 96 at a time
> >
> > 1060! / (1060 - 96)!
>
> Well, this gives you
>
> 3179049214270213494856036082395246272767603703117029227219760559555570970143122666905356954926552940841376332310832740817342891028120773779767941521978678527871167070887214646849981846725146620998653633794832176123350796907123110479415043912870243292225353946234880000000000000000000000000
>
> lists. Assuming you have a 4GHz machine, and assuming you can
> process one element per processor cycle (which you can't in
> any programming language), you would still need
>
> 25201747322664680800165176959627459671229735089398062747493028281611261495934191613595232075457833435132676404036916070660062238617142105686897050370835541348547430483314423570284610022871849798632147655019915145574508473705630949386534784951089574551507435520000000000000
>
> years to process them all. Even if you had 10000000000
> computers (i.e. one per human being on the planet), you
> still need ... you get the idea.
>

I under stand all these calculations.

> > Now out of these i need to test only those lists whose sum of
> > elements(18 or 19) follows a particular pattern.
>
> To succeed, you must take this condition into account.
> What is the particular pattern?
>

here is the pattern:

If
A = 18
B = 19

    ONLY POSSIBLE Sequence of A, B type rows is as follows
    A B A A B A B A A B A A B A A B A B A A B A A B A B A A B A
(REPEATING after this)

I need only thos permutations that follow this pattern. After that I
need to look of a few groupings of elements. like:

     (2, 2) = 61 occurs times
     (1, 1) = 54 occurs times
     (2, 2, 2) = 29 occurs times
     (1, 1, 1) = 13 occurs times

and so on. I am looking for the 96 row matrix that satisfies these
groupings.




More information about the Python-list mailing list