Posts

Showing posts with the label Combinatorics

A Fair Die Is Rolled N Times. What Is The Probability That At Least 1 Of The 6 Values Never Appears?

Answer : I think via inclusion/exclusion the probability that at least one of the six values never appears after n rolls of the die would be: p ( n ) = ( 6 1 ) ( 5 6 ) n − ( 6 2 ) ( 4 6 ) n + ( 6 3 ) ( 3 6 ) n − ( 6 4 ) ( 2 6 ) n + ( 6 5 ) ( 1 6 ) n p(n) = {6 \choose 1}({5 \over 6})^n - {6 \choose 2}({4 \over 6})^n + {6 \choose 3}({3 \over 6})^n - {6 \choose 4}({2 \over 6})^n + {6 \choose 5}({1 \over 6})^n p ( n ) = ( 1 6 ​ ) ( 6 5 ​ ) n − ( 2 6 ​ ) ( 6 4 ​ ) n + ( 3 6 ​ ) ( 6 3 ​ ) n − ( 4 6 ​ ) ( 6 2 ​ ) n + ( 5 6 ​ ) ( 6 1 ​ ) n To understand, first just consider the probability of a 1 never showing up: ( 5 6 ) n ({5 \over 6})^n ( 6 5 ​ ) n Easy enough. Now what are the chances of either a 1 never showing up OR a 2 never showing up. To first order it's just twice the above, but by simply doubling the above, you've double-counted the events where neither a 1 nor a 2 show up, so you have to subtract that off to correct the double counting: 2 ( 5 6 ) n − ( 4 6 ) ...

Book Recommendation : Olympiad Combinatorics Book

Answer : Here is a list of books for perfect olympiad combinatorics preparation. For general study: (1) A Path to Combinatorics for Undergraduates (2) Principles and Techniques in Combinatorics (3) Problem-Solving Methods in Combinatorics: An Approach to Olympiad Problems For practising problem-solving: (1) 102 Combinatorial Problems (2) Combinatorics: A Problem-Based Approach (3) The IMO Compendium: A Collection of Problems Suggested for The International Mathematical Olympiads: 1959-2009 Second Edition For Olympiad Graph theory: Olympiad uses of graph theory is a bit different from formal graph theory taught in university courses. The best book for this is (1) Graph Theory: In Mathematical Olympiad And Competitions (2) IMO Training 2008: Graph Theory For probabilistic methods in olympiad combinatorics: (1) Expected uses of probability (2) Unexpected uses of probability For generating functions and recurrence relations: Generatingfunctionology For combinatorial in...

BASKETBALL FRVR?

Answer : JavaScript (ES6), 73 72 bytes Prints all unique, lexically sorted combinations. f=(n,p=0,s='')=>n?n>1&&f(n-2,0,s+'S')&f(n-(p-9?p+=3:9),p,s+'V'):alert(s) Test cases In this snippet, alert() has been replaced by console.log() for user-friendliness. f=(n,p=0,s='')=>n?n>1&&f(n-2,0,s+'S')&f(n-(p-9?p+=3:9),p,s+'V'):console.log(s) ;[2, 3, 4, 12, 16] .forEach(n => { console.log('[' + n + ']'); f(n); }) Jelly, 30 bytes o2,5ṁo8‘ Hṗ@€⁾VSẎðOḂŒgÇ€FS=ðÐf A monadic link returning a list of the strings (lists of characters). Try it online! - The footer calls the link and separates the entries by newlines since a full program's implicit output would smash them together. How? o2,5ṁo8‘ - Link 1, helper to form shot scores: list of shots grouped by type (S=1 and V=0) - e.g. [[1,1],[0,0,0,0,0],[1,1],[0],[1,1]] 2,5 ...

Combinatoric 'N Choose R' In Java Math?

Answer : The Formula It's actually very easy to compute N choose K without even computing factorials. We know that the formula for (N choose K) is: N! -------- (N-K)!K! Therefore, the formula for (N choose K+1) is: N! N! N! N! (N-K) ---------------- = --------------- = -------------------- = -------- x ----- (N-(K+1))!(K+1)! (N-K-1)! (K+1)! (N-K)!/(N-K) K!(K+1) (N-K)!K! (K+1) That is: (N choose K+1) = (N choose K) * (N-K)/(K+1) We also know that (N choose 0) is: N! ---- = 1 N!0! So this gives us an easy starting point, and using the formula above, we can find (N choose K) for any K > 0 with K multiplications and K divisions. Easy Pascal's Triangle Putting the above together, we can easily generate Pascal's triangle as follows: for (int n = 0; n < 10; n++) { int nCk = 1; for (int k = 0; k <= n; k++) { System.out.print(nCk +...

Calculating The Total Number Of Surjective Functions

Answer : Consider f − 1 ( y ) f^{-1}(y) f − 1 ( y ) , y ∈ Y y \in Y y ∈ Y . This set must be non-empty, regardless of y y y . What you're asking for is the number of ways to distribute the elements of X X X into these sets. The number of ways to distribute m elements into n non-empty sets is given by the Stirling numbers of the second kind, S ( m , n ) S(m,n) S ( m , n ) . However, each element of Y Y Y can be associated with any of these sets, so you pick up an extra factor of n ! n! n ! : the total number should be S ( m , n ) n ! S(m,n) n! S ( m , n ) n ! The Stirling numbers have interesting properties. They're worth checking out for their own sake. Here is a solution that does not involve the Stirling numbers of the second kind, S ( n , m ) S(n,m) S ( n , m ) . The number of surjective functions from a set X X X with m m m elements to a set Y Y Y with n n n elements is ∑ i = 0 n − 1 ( − 1 ) i ( n i ) ( n − i ) m \sum_{i=0}^{n-1} (-1)^i{n \choose i}(n-i)^m...