at least the first 20 SOL are fun ;P
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
N = 101;
n = 3;
y_correct = 0.1200;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match')))) % modified from the comment of Alfonso on https://www.mathworks.com/matlabcentral/cody/problems/44343
y =
0.1200
|
2 | Pass |
N = 201;
n = 6;
y_correct = 0.0750;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
n =
4
y =
0.0750
|
3 | Pass |
N = 202;
n = 6;
y_correct = 0.0796;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
n =
3
y =
0.0796
|
4 | Pass |
N = 203;
n = 6;
y_correct = 0.0792;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
n =
1
y =
0.0792
|
5 | Pass |
N = 1001;
n = 9;
y_correct = 0.1050;
assert(abs(pidigit(N,n)-y_correct)<0.0001)
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[101,201,202,203,1001]),regexp(fileread('pidigit.m'),'[\d\.\+\-\*\/]+','match'))))
y =
0.1050
|
Find the two most distant points
1628 Solvers
686 Solvers
Getting the indices from a vector
3207 Solvers
Circular Primes (based on Project Euler, problem 35)
140 Solvers
Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)
226 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!