Cody

# Problem 44309. Pi Digit Probability

Solution 1292260

Submitted on 17 Oct 2017
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 = 101; n = 3; y_correct = 0.1200; assert(abs(pidigit(N,n)-y_correct)<0.0001)

Undefined function 'vpa' for input arguments of type 'double'. Error in pidigit (line 2) y = round(numel(find(char(vpa(pi,N-1))==num2str(n)))/(N-1),4); Error in Test1 (line 4) assert(abs(pidigit(N,n)-y_correct)<0.0001)

2   Fail
N = 201; n = 6; y_correct = 0.0800; assert(abs(pidigit(N,n)-y_correct)<0.0001)

Undefined function 'vpa' for input arguments of type 'double'. Error in pidigit (line 2) y = round(numel(find(char(vpa(pi,N-1))==num2str(n)))/(N-1),4); Error in Test2 (line 4) assert(abs(pidigit(N,n)-y_correct)<0.0001)

3   Fail
N = 202; n = 6; y_correct = 0.0796; assert(abs(pidigit(N,n)-y_correct)<0.0001)

Undefined function 'vpa' for input arguments of type 'double'. Error in pidigit (line 2) y = round(numel(find(char(vpa(pi,N-1))==num2str(n)))/(N-1),4); Error in Test3 (line 4) assert(abs(pidigit(N,n)-y_correct)<0.0001)

4   Fail
N = 203; n = 6; y_correct = 0.0792; assert(abs(pidigit(N,n)-y_correct)<0.0001)

Undefined function 'vpa' for input arguments of type 'double'. Error in pidigit (line 2) y = round(numel(find(char(vpa(pi,N-1))==num2str(n)))/(N-1),4); Error in Test4 (line 4) assert(abs(pidigit(N,n)-y_correct)<0.0001)

5   Fail
N = 1001; n = 9; y_correct = 0.1060; assert(abs(pidigit(N,n)-y_correct)<0.0001)

Undefined function 'vpa' for input arguments of type 'double'. Error in pidigit (line 2) y = round(numel(find(char(vpa(pi,N-1))==num2str(n)))/(N-1),4); Error in Test5 (line 4) assert(abs(pidigit(N,n)-y_correct)<0.0001)