View Single Post
  #23   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_5_] Peter T[_5_] is offline
external usenet poster
 
Posts: 84
Default List all combinations of 6/36 with unique 4 numbers


"joeu2004" wrote in message
...

I had interpreted Martin's problem to be: find all combinations of 6 of
36 numbers such that each contains unique subsets of 4 numbers; that is,
so that no 4-number subset ("quad") is repeated. (Call this Problem #1.)


Me too.


However, now we believe that Martin's real goal is a "full wheel" of all
36 numbers. Thus, he wants to find the __minimum__ set of combinations of
6 of 36 numbers needed to guarantee matching at least 4 of 6 numbers
drawn. (Call this Problem #2.)


Really, why, has he said that? (I'm using a newsreader and can't see
anything about that)

Afraid I don't follow the objective yet alone the approach or solution
described below (mostly snipped as only one more comment for the moment),
but it's late here, maybe tomorrow.


Basically, I iterate over all COMBIN(36,6) combinations (1,974,792) 15
times allowing for an increasing number (0 to 14) of duplicate quads. 15
is the number of quads in each combination, namely COMBIN(6,4).


Well that's what mine was doing, but a LOT more times that that, which is
why it was so slow, even with some a few things to bail out early if no
point continuing.

Although I am not happy with the multiple iterations over the nearly 2
million combinations, the run time for the solution for Problem #2 is
"only" about 129 seconds on my computer. (YMMV.)


Probably not worth busting a gut for something that will only ever need to
run once to produce a single listing!

(yeah I know!)

Regards,
Peter T