Board index » delphi » Number Sequences ?

Number Sequences ?

On Tue, 26 Aug 1997 19:32:07 +0100, Al Nicholls

Quote
<A...@exesoftware.demon.co.uk> wrote:
>I need some code to produce all the different six number sequences for
>the numbers 1 - 49.  Just to complicate things a little, they also need
>to be in order ie. 10/15/22/33/46/49.  

for i:=1 to 44 do
for j:=i+1 to 45 do
for k:=j+1 to 46 do
for l:=k+1 to 47 do
for m:=l+1 to 48 do
for n:=m+1 to 49 do

    process(i,j,k,l,m,n); // six unique numbers 1-49, in order

 

Re:Number Sequences ?


Quote
Al Nicholls wrote:

> Hi,

> Can anyone help me?

> I need some code to produce all the different six number sequences for
> the numbers 1 - 49.  Just to complicate things a little, they also need
> to be in order ie. 10/15/22/33/46/49.  The sequences need to be written
> to a file one line at a time so they can be imported into Excel (if it
> can be done in Excel even better).   I am sure is going to be a huge
> file considering there are over 14,000,000 different combinations!

        Who told you that? Seems to me the number is a little less than
14,000,000. Regardless, this is going to be about a 200MB file - I
can't imagine how there could be a problem for which this is the right
solution. Why do you want these numbers? There must be a better way to
do whatever you have in mind.

        (A 200MB file containing the complete works of Shakespeare could
be the right solution to some problem, since there's no way to figure out
the text of Romeo and Juliet from the text of Hamlet. But _this_ 200 MB
file is very different - this is going to be a very boring 200MB file,
because of all that structure.)

--
David Ullrich

sig.txt not found

Re:Number Sequences ?


Quote
Rodney E Geraghty wrote:

> There are 13,983,816 possibel combinations.  Sounds like he's trying find
> all the tickets for a 6/49 lottery.

        And then what? Buying one of each is a sure way to win the lottery
and lose money at the same time...

--
David Ullrich

sig.txt not found

Re:Number Sequences ?


Quote
David Ullrich <ullr...@math.okstate.edu> wrote:
>Rodney E Geraghty wrote:

>> There are 13,983,816 possibel combinations.  Sounds like he's trying find
>> all the tickets for a 6/49 lottery.

>    And then what? Buying one of each is a sure way to win the lottery
>and lose money at the same time...

Not necessarily.  If the jackpot is progressive and has not been won in
quite some time, the jackpot could be considerably more than $14 million.
I have heard (although it may be urban legend) that California will issue
you a special one-of-every-number ticket if you bring them a check for
$13,983,816.  (Although I believe California's Lotto is now 6/56; it used
to be 6/49 but that didn't generate enough revenue.)

There are two problems with this approach.  First, there is the danger
someone else will also win, cutting the jackpot in half or worse.  Second,
the lottery payout is amortized over 20 years.  Even on a $100 million
jackpot, you'd only get $2.5 million (after taxes) in year one, and you're
probably going to be paying a million a year in interest on the loan for
your ticket!

- Tim Roberts, t...@probo.com
  Providenza & Boekelheide, Inc.

Other Threads