Cody

Problem 1267. Calculate the probability that at least two people in a group share the same birthday.

Solution 2737408

Submitted on 24 Jul 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
n = 1; y_correct = 0.00; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test1 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

2   Fail
n = 366; y_correct = 1.00; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test2 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

3   Fail
n = 0; y_correct = 0.00; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test3 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

4   Fail
n = 23; y_correct = 0.5073; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test4 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

5   Fail
n = 50; y_correct = 0.9704; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test5 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

6   Fail
n = 100; y_correct = 1.0000; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test6 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

7   Fail
n = 10 y_correct = 0.1169; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

n = 10

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test7 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

8   Fail
n = 13 y_correct = 0.1944; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

n = 13

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test8 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)

9   Fail
n = 2; y_correct = 1/365; assert(abs(birthday_prob(n)-y_correct) <= 0.015)

Unrecognized function or variable 'x'. Error in birthday_prob (line 2) if x>364 Error in Test9 (line 3) assert(abs(birthday_prob(n)-y_correct) <= 0.015)