|
|
|
|
 |

August 6th, 2003, 09:43 PM
|
 |
National Security Advisor
|
|
Join Date: Jan 2001
Location: Ohio
Posts: 8,450
Thanks: 0
Thanked 5 Times in 2 Posts
|
|
Re: Math problem
No, that's not right.
LGM, I didn't mean any offense. I looked at your initial post and didn't think it solved teh problme, but after looking at it again I see it does. Can you explain the math your program is doing to find the solutions? That is what I am trying to figure out.
Geoschmo
__________________
I used to be somebody but now I am somebody else
Who I'll be tomorrow is anybody's guess
|

August 6th, 2003, 09:43 PM
|
 |
Brigadier General
|
|
Join Date: Apr 2002
Location: Kailua, Hawaii
Posts: 1,860
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Re: Math problem
I didn't read all the replies, so pardon this if already stated, but aren't you talking about the statistical formula for combinations? Mathematically, it means: how many ways can I group n things in groupings of r where the order of grouping is not important. (There is a separate formula for permutations where order is important)
The general formula for C(n,r) = n!/[r!(n-r)!]
Where the number of combinations C(n,r) is a function of the total number of people n taken r at a time.
You don't need any particular number of players to start with. If n = 10 and r = 3 then the required number of games is 10!/[3!x7!] = 120
Exactly how to arrange the people in each game is most easily worked out by hand although I suppose it could be done with a program.
Slick.
__________________
Slick.
|

August 6th, 2003, 09:47 PM
|
 |
Sergeant
|
|
Join Date: Apr 2001
Location: Minneapolis, MN, USA
Posts: 222
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Math problem
Only solutions are 3, 7, 15, 31,...
Other numbers of players leave a three some with two players and no one to match them with. Someone demonstrated this earlier with 9 players.
|

August 6th, 2003, 09:49 PM
|
 |
National Security Advisor
|
|
Join Date: Jan 2001
Location: Ohio
Posts: 8,450
Thanks: 0
Thanked 5 Times in 2 Posts
|
|
Re: Math problem
Sorry slick, this is way over my head.
"The general formula for C(n,r) = n!/[r!(n-r)!]"
What do n and r represent in the formula, and what are the exclamation points for?
And is C(n,r) the total numebr of players needed in the tourney, or the number of games played by each person in the tourney, or something else alltogether? 
__________________
I used to be somebody but now I am somebody else
Who I'll be tomorrow is anybody's guess
|

August 6th, 2003, 09:50 PM
|
 |
National Security Advisor
|
|
Join Date: Jan 2001
Location: Ohio
Posts: 8,450
Thanks: 0
Thanked 5 Times in 2 Posts
|
|
Re: Math problem
Quote:
Originally posted by LGM:
Only solutions are 3, 7, 15, 31,...
Other numbers of players leave a three some with two players and no one to match them with. Someone demonstrated this earlier with 9 players.
|
Right, but other then working them out by hand, or having you plug it into yoru black box and give me the result, can you explain how you know this? What I am trying to learn is not the answer, but how the answer is derived.
Geoschmo
__________________
I used to be somebody but now I am somebody else
Who I'll be tomorrow is anybody's guess
|

August 6th, 2003, 09:55 PM
|
 |
Sergeant
|
|
Join Date: Apr 2001
Location: Minneapolis, MN, USA
Posts: 222
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Math problem
Here is the code. Crudely done by brute force in a rather esoteric flavor of basic:
PRIMES = '2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61 ,67,71,73,79,83,89,97,101,103,109,113,127,131,137'
SWAP ',' WITH @AM IN PRIMES
ILIMIT = DCOUNT(PRIMES,@AM)
PRINT ILIMIT
FOR I = 4 TO ILIMIT
NBR = I
COMBOS = ''
COMBOX = ''
IDX = 1
FOR J = 1 TO I
FOR K = J+1 TO I
FOR L = K+1 TO I
GOSUB FIND.DUPLICATE
IF NOT(FOUND.DUPLICATE) THEN
COMBOS<-1> = PRIMES*PRIMES*PRIMES
COMBOX<-1> = J:',':K:',':L
END
NEXT L
NEXT K
NEXT J
GOSUB CHECK.SOLUTION
NEXT I
PRINT 'DONE'
STOP
*
SOLVED:*
PRINT '---------------------'
PRINT 'SOLVED'
PRINT NBR
FOR M = DCOUNT(COMBOX,@AM) TO 1 STEP -1
PRINT COMBOX
NEXT M
INPUT CH,1_
RETURN
*
CHECK.SOLUTION: *
FOR J = 1 TO I
FOR K = J + 1 TO I
NBR.MATCHES = 0
FOR M = DCOUNT(COMBOS,@AM) TO 1 STEP -1
A.COMBO = COMBOS
IF MOD(A.COMBO,PRIMES)=0 AND MOD(A.COMBO,PRIMES)=0 THEN
NBR.MATCHES = NBR.MATCHES + 1
IF NBR.MATCHES > 1 THEN RETURN
END
NEXT M
IF NBR.MATCHES = 0 THEN RETURN
NEXT K
NEXT J
GOSUB SOLVED
RETURN
*
FIND.DUPLICATE: *
FOUND.DUPLICATE = 0
FOR M = DCOUNT(COMBOS,@AM) TO 1 STEP -1
A.COMBO = COMBOS
J.MOD = MOD(A.COMBO,PRIMES)
K.MOD = MOD(A.COMBO,PRIMES)
L.MOD = MOD(A.COMBO,PRIMES)
IF J.MOD = 0 THEN
IF K.MOD=0 OR L.MOD=0 THEN
FOUND.DUPLICATE = 1
END
END ELSE IF K.MOD=0 AND L.MOD=0 THEN
FOUND.DUPLICATE = 1
END
NEXT M
RETURN
|

August 6th, 2003, 10:01 PM
|
 |
National Security Advisor
|
|
Join Date: Jan 2001
Location: Ohio
Posts: 8,450
Thanks: 0
Thanked 5 Times in 2 Posts
|
|
Re: Math problem
Ok, so bascially you are having the couputer run through all the possible options fast and see if a number works. Ok, that does the job but isn't really what I was looking for. Mayeb there is no simple mathematical formula for what I am looking for.
Basically I can take x players and group them into games of three players each and see fairly quickly that 7 players will work, but 5 will not. What I was hoping to find was a formula that I could plug the numbers in and be able to tell if a combination of x and y would work without having to go through all teh grouping by hand.
Geoschmo
__________________
I used to be somebody but now I am somebody else
Who I'll be tomorrow is anybody's guess
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|