MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Just some thousands of combinations...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109934] Re: Just some thousands of combinations...
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Sun, 23 May 2010 07:19:59 -0400 (EDT)
  • References: <htakq5$509$1@smc.vnet.net>

On May 23, 12:17 am, "Dr. Bruno Campanini" <cmp... at gmail.com> wrote:
> Subsets[Range[90],{5}]  should print all the
> Binomial[90,5] = 43 949 268 combinations.
>
> On my PC (4gb RAM) Mathematica 7.0 claims
> "Not enough memory".
>
> By the way, I only need to print some thousands
> of these combinations, then Subsets[Range[90],{5}, 3000]
> works fine.
> But it prints the first 3000 combination in lexicographic
> order. How to get 3000 random out of 43 949 268, not
> ordered?
>
> Bruno

This has a 90% chance of Length[s] being 3000.
It's very fast. Just keep trying until you get it.

Dimensions[s = Union@Table[Sort@RandomSample[Range@90,5],{3000}]]


  • Prev by Date: Re: Just some thousands of combinations...
  • Next by Date: Re: Just some thousands of combinations...
  • Previous by thread: Re: Just some thousands of combinations...
  • Next by thread: Re: Just some thousands of combinations...