[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

660.0. "MegaBucks system" by PLDVAX::ZARLENGA (Bigger they are, Harder they hit) Wed Jan 28 1987 17:34

    	Please help me disprove a MegaBuck maniac.
    
    	I need to know how many combinations of 6 numbers from a
    pool of 1 thru 36 will add up to 111. No number may be repeated,
    etc same as MegaBucks.
    
    	An equation is desired, but the answer is also acceptable.
    
    	Thanks,  mike z
T.RTitleUserPersonal
Name
DateLines
660.1Here's a start...JON::MORONEYLegalize LibertyWed Jan 28 1987 21:014
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.2192,804COMET::ROBERTSDwayne RobertsThu Jan 29 1987 01:196
    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.3PLDVAX::ZARLENGABigger they are, Harder they hitThu Jan 29 1987 11:313
    re .2 - thanks.  how do you arrive at 192,804 ?
    
-mike
660.4I did it the "hard" way.JON::MORONEYLegalize LibertyThu Jan 29 1987 13:039
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.5J'adjustCOMET::ROBERTSDwayne RobertsThu Jan 29 1987 15:065
    re .4:
    
    Mike, I concur with your numbers.  I mis-programmed my original
    counting program.  Note 660.2 is _incorrect_.
    
660.6How about the more general problem, then?SQM::HALLYBAre all the good ones taken?Thu Jan 29 1987 23:558
    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.7No numbers, pleaseMODEL::YARBROUGHFri Jan 30 1987 11:4966
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.8brute force only?ANGORA::ZARLENGABigger they are, Harder they hitFri Jan 30 1987 12:414
    	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::HALLYBAre all the good ones taken?Fri Jan 30 1987 14:265
> 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.10Coincidence?ZFC::DERAMODaniel V. D'EramoMon Nov 30 1987 23:158
    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.11BLITZN::ROBERTSPeace .XOR. Freedom ?Tue Dec 01 1987 13:148
    RE .10
    
    > What kind of error multiplied the correct result by six?
    
    No recollection.  I didn't keep the program.
    
    						/Dwayne