View Single Post
  #27   Report Post  
Posted to microsoft.public.excel.programming
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default List all combinations of 6/36 with unique 4 numbers

"Peter T" wrote in message
...
Ah, OK, so I had a go, and came up with 57725 6-number
cominations. Obviously that's not right but FWIW this is
what I did -

[....]
That all works surprising quickly (less than a minute),
but what am I misunderstanding or missing?


I have no idea. I don't understand what you are trying to achieve; that is,
which problem you are working on, and with what constraints and goals. And
I don't understand your description of your algorithm. Obviously, uploading
the actual code to a file-sharing website would help. "A program is worth a
thousand words" ;-). But don't bother for my benefit alone. I think this
will be my last posting in this thread unless Martin has some questions.

First, after Googling "lottery wheel algorithm", it has become clear that
this has been a programming challenge for some time. There is some
interesting reading material out there. But I was unable to find useful
source code for any self-described "good" algorithms.

Second, after some further experimentation, it seems clear to me now that
Problem #1 is poorly specified. And I no longer see it as a useful problem
to solve. To elaborate just a bit....

My original deterministic algorithm found 2240 combinations of 6-of-36
numbers that contain unique 4-number sets (quads; aka 4-tuples). But to
what end?

I already demonstrated that it covers only 33,600 of the 58,905 combinations
of 4-of-36 numbers. So the 2240 combinations do not cover all possible ways
to match 4-of-6 drawn numbers.

Those 2240 combinations __are__ the minimum number of combinations needed to
cover all 36 numbers without repeating any quads. But only if we use that
particular deterministic algorithm. That is, only if we select 6-of-36
tuples in that order.

When I replace the deterministic algorithm with one that randomly selects
from all 1,947,792 combinations of 6-of-36 numbers (but only if every quad
of each combination is unique), I stumbled upon a set of 17(!) combinations
that cover all 36 numbers without repeating any quads.

And even that might not be the smallest set. I cannot prove one way or
another. But I note that with 17 6-tuples, each of the 36 numbers is used
2.833..33 times on average -- 1 to 6 times in practice. So theoretically,
there might be a solution with a smaller average; ergo, few 6-tuples.

Finally, with respect to problem #2 -- the wheeling problem -- I had
previously described a solution with 5456 combinations of 6-of-36 numbers
that cover all 58,905 combinations of 4-of-6 drawn numbers. That is, it
does cover all possible ways to match 4-of-6 drawn numbers.

(Recall that that includes some duplicate quads necessarily.)

But I had noted that I cannot prove whether or not that is an optimal
solution; that is, the fewest number of combinations.

I suspect it is not. But when I replaced the deterministic selection
algorithm with a random selection similar to the one described above, my
first attempt required a set of 5596 combinations of 6-of-36 numbers to
cover all 58,905 combinations of 4-of-6 drawn numbers. More combinations.

Nevertheless, that proves nothing. It is only one random trial.

Disclaimer.... I am not suggesting that random selection is the way to go.
I am merely using those random selection to stumble upon some alternate
solutions that, for me, offer some insight into the parameters of the
problem(s).