Determining the Sequence Number of random lottery values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How would one determine the sequence number of 6 random lottery values
between 1 and 53. If the lowest possible combination was 1-2-3-4-5-6 and that
was sequence 1, then 1-2-3-4-5-7 was seqence 2...and so forth. I could build
a nested loop, but that would be terribly slow. Is there a more direct
approach? Thanks, Art
 
Do you mean you want to get a list of all the possible combinations?
If so, a Cartesian query seems indicated. Create a table (I've called
is Numbers) with a single Number (Long) field, and enter one record
for each number from 1 to the maximum. Start with just a few (I used 1
to 6).

The query looks like this (which just combines three values, but it's
obvious how to extend it to six):

SELECT A.N AS N1, B.N AS N2, C.N AS N3
FROM Numbers AS A, Numbers AS B, Numbers AS C
Order by 1,2,3;

You could use this as the basis of a make-table query.

Don't forget that with 6 out of 53 you have quite a lot of
combinations, tens of millions at a guess.
 
kartcon said:
How would one determine the sequence number of 6 random lottery values
between 1 and 53. If the lowest possible combination was 1-2-3-4-5-6 and that
was sequence 1, then 1-2-3-4-5-7 was seqence 2...and so forth. I could build
a nested loop, but that would be terribly slow. Is there a more direct
approach?


There are ways to generate one of those lottery values, but
what good is knowing where a lottery values is in the
sequence? Except for lottery values where the same number
would appear more than once, the lottery value itself is a
reasonable representation of where it appears in the
sequence of all possible lottery values.
 
Back
Top