Cody

# Problem 1272. The almost-birthday problem.

Solution 1429973

Submitted on 31 Jan 2018
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 = 10; d = 1; y_correct = 0.3147; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test1 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

2   Fail
n = 14; d = 1; y_correct = 0.5375; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test2 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

3   Fail
n = 20; d = 1; y_correct = 0.8045; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test3 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

4   Fail
n = 25; d = 1; y_correct = 0.9263; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test4 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

5   Fail
n = 30; d = 1; y_correct = 0.9782; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test5 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

6   Fail
n = 35; d = 1; y_correct = 0.9950; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test6 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

7   Fail
n = 10; d = 2; y_correct = 0.4721; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test7 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

8   Fail
n = 14; d = 2; y_correct = 0.7305; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test8 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

9   Fail
n = 20; d = 2; y_correct = 0.9393; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test9 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

10   Fail
n = 25; d = 2; y_correct = 0.9890; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test10 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

11   Fail
n = 30; d = 2; y_correct = 0.9987; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test11 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

12   Fail
n = 10; d = 3; y_correct = 0.5965; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test12 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

13   Fail
n = 14; d = 3; y_correct = 0.8466; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test13 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

14   Fail
n = 20; d = 3; y_correct = 0.9826; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test14 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

15   Fail
n = 25; d = 3; y_correct = 0.9986; assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)

Error: File: almostBirthday.m Line: 10 Column: 9 "i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval. Error in Test15 (line 4) assert(abs(almostBirthday(n,d)-y_correct) <= 0.0001)