T.R | Title | User | Personal Name | Date | Lines |
---|
660.1 | Here's a start... | JON::MORONEY | Legalize Liberty | Wed Jan 28 1987 18:01 | 4 |
| I think 111 is the sum that MIGHT be most frequent, but the fact you can't draw
the same number twice may change this. If you could draw the same number
multiple times, the average value for each draw is 18.5, so 6 draws would
average to be 111, which is also the peak of the bell curve of the sum.
|
660.2 | 192,804 | COMET::ROBERTS | Dwayne Roberts | Wed Jan 28 1987 22:19 | 6 |
| If there are 36 balls numbered 1 through 36 of which six balls are
chosen, then there are 192,804 ways in which these balls can add
up to 111. There are 1,947,792 ways in which six balls can be
selected. This makes the odds approximately 9.1 to 1 against the
sum being 111.
|
660.3 | | PLDVAX::ZARLENGA | Bigger they are, Harder they hit | Thu Jan 29 1987 08:31 | 3 |
| re .2 - thanks. how do you arrive at 192,804 ?
-mike
|
660.4 | I did it the "hard" way. | JON::MORONEY | Legalize Liberty | Thu Jan 29 1987 10:03 | 9 |
| re .2:
That's not the answer I got. I ran a program that computed all possible
combinations that could come up in the Megabucks lottery, and added the digits,
then counted the frequency of the sums. 111 was the most frequent sum, but
occurred exactly 32,134 times out of 1,947,792 outcomes or odds about 60.6-1
against it coming up.
-Mike
|
660.5 | J'adjust | COMET::ROBERTS | Dwayne Roberts | Thu Jan 29 1987 12:06 | 5 |
| re .4:
Mike, I concur with your numbers. I mis-programmed my original
counting program. Note 660.2 is _incorrect_.
|
660.6 | How about the more general problem, then? | SQM::HALLYB | Are all the good ones taken? | Thu Jan 29 1987 20:55 | 8 |
| Would it be possible to have the entire distribution printed here?
I.e., for j in {21, 22, 23, ..., 199, 200, 201} print N(j), the
number of distinct tickets with selected numbers that add up to j.
I'll do the fluffery: N(21) = 1, N(201) = 1. N(222-j) = N(j).
That's more than half the work!
John
|
660.7 | No numbers, please | MODEL::YARBROUGH | | Fri Jan 30 1987 08:49 | 66 |
| PLEASE let's not fill this note with 16,000+ numbers. I'll put a program here
that someone can use to generate them at leisure. A subroutine to generate
the next k-subset of an n-set follows, then a driver to do the counting.
SUBROUTINE nexksb (n, k, a, mtc)
C Next k-set of an n-set, in lexicographic order
C Arguments:
C n integer
C k integer
C A Integer array to hold the current set of elements (1..n)
C MTC Logical: More To Come
C======================================================================
INTEGER n, k, a(k)
LOGICAL mtc
INTEGER h, j, m, klast, nlast
DATA nlast, klast /0, 0/
C======================================================================
IF (n .EQ. nlast .AND. k .EQ. klast .AND. mtc) THEN
! We are in the midst of a sequence, find the next one to return
h = 1
DO WHILE (a(k+1-h) .EQ. n+1-h .AND. h .LE. k)
h = h + 1
END DO
m = a(k+1-h)
ELSE
! Either the calling parameters have changed or we have exhausted
! the previous set, so start over.
nlast = n
klast = k
mtc = .true.
m = 0
h = k
END IF
DO j = 1, h
a(k+j-h) = m + j
END DO
mtc = a(1) .NE. n-k+1
RETURN
END
PROGRAM nexksb_test
LOGICAL*1 mtc
INTEGER*4 a, i, k, n
INTEGER*4 count, sum
PARAMETER (n=36)
PARAMETER (k=6)
DIMENSION a(k)
C======================================================================
count = 0
mtc = .TRUE.
DO WHILE (mtc)
call nexksb (n, k, a, mtc)
sum = 0
DO i=1,k
sum = sum + a(i)
END DO
IF (sum .EQ. 111) THEN
count = count + 1
C TYPE *, a
END IF
END DO
type *, 'Count = ', count
END
|
660.8 | brute force only? | ANGORA::ZARLENGA | Bigger they are, Harder they hit | Fri Jan 30 1987 09:41 | 4 |
| So the answer is 32,134. OK, but is there a general equation
or must this be brute forced via computer?
-mike z
|
660.9 | |{21, 22, ... , 200, 201}| = 181 << "16,000 +" | SQM::HALLYB | Are all the good ones taken? | Fri Jan 30 1987 11:26 | 5 |
| > PLEASE let's not fill this note with 16,000+ numbers.
I agree we don't need 16,000 numbers. We only need 181.
This may lead the more adventurous to conjecture closed
forms for generating N(j).
|
660.10 | Coincidence? | ZFC::DERAMO | Daniel V. D'Eramo | Mon Nov 30 1987 20:15 | 8 |
| Re .5
The incorrect number 192,804 given in .2 is exactly six times the
count of 32,134 given in .4. Assuming that the latter is correct,
I would say that your original counting program had to be "almost
correct." What kind of error multiplied the correct result by six?
Dan
|
660.11 | | BLITZN::ROBERTS | Peace .XOR. Freedom ? | Tue Dec 01 1987 10:14 | 8 |
| RE .10
> What kind of error multiplied the correct result by six?
No recollection. I didn't keep the program.
/Dwayne
|