Maximizing Probability of one type from N containers | Returns the Maximum probability for Drawing 1 copy of number A from N containers with N copies each of numbers A and B ; Pmax = N / ( N + 1 ) ; 1. N = 1 ; 2. N = 2 ; 3. N = 10
< ? php function calculateProbability ( $ N ) { $ probability = $ N / ( $ N + 1 ) ; return $ probability ; } $ N = 1 ; $ probabilityMax = calculateProbability ( $ N ) ; echo ( " Maximum ▁ Probability ▁ for ▁ N ▁ = ▁ " . $ N . " is , " round ( $ probabilityMax , 4 ) . " STRNEWLINE " ) ; $ N = 2 ; $ probabilityMax = calculateProbability ( $ N ) ; echo ( " Maximum ▁ Probability ▁ for ▁ N ▁ = ▁ " . $ N . " is , " round ( $ probabilityMax , 4 ) . " STRNEWLINE " ) ; $ N = 10 ; $ probabilityMax = calculateProbability ( $ N ) ; echo ( " Maximum ▁ Probability ▁ for ▁ N ▁ = ▁ " . $ N . " is , " round ( $ probabilityMax , 4 ) . " STRNEWLINE " ) ; ? >