|
||||||
Title: No of Independent Event.. Post by k3rn3l on Feb 14th, 2009, 10:21am Given n ( Sample Space = S) and two events A (subset of S ) and B ( subset of S)..How many possible combo of A & B will be independent event..?? n can be considered to be a dice with n faces wth equal probability of each face.. Like for example n = 3; Total number of independent event is 13 Here it is : Code:
Quote:
I know the value will increase rapidly with n ...so output will be d value after taking mod of 100000000. Thnks in advance...i tried it solving for 2 hrs but i m not able..!! Some ans i may give...for ur checking: n = 6 ----> 845 7 ----> 253 8 ----> 7509 9 ---->16141 Code:
|
||||||
Title: Re: No of Independent Event.. Post by towr on Feb 14th, 2009, 1:26pm Here's a bit of javascript that solves the first problem in O(n3)-ish time. There's definite room for improvement, though (e.g. you can solve for c) . But I don't plan on working on this any more tonight. Code:
It's interesting how the results of prime numbers jump out. (Although not surprising, once you understand how this algorithm works) |
||||||
Title: Re: No of Independent Event.. Post by Eigenray on Feb 14th, 2009, 6:54pm Using the same formula, a Mathematica one-liner: Code:
|
||||||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |