This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
x = 0.5;
r = 0.999;
n = 1;
x_correct = 0.5;
p_correct = 0.5;
[p, x] = f(x, r, n);
assert(isequal(p,p_correct));
assert(x==x_correct);
|
2 | Fail |
x = 0.5;
r = 0.999;
n = 2;
x_correct = 0.999;
p_correct = [1 0];
[p, x] = f(x, r, n);
assert(isequal(p,p_correct));
assert(x==x_correct);
|
3 | Fail |
x = 0.5;
r = 0.999;
n = 3;
x_correct = 0.00399;
p_correct = [-4 4 0 0];
[p, x] = f(x, r, n);
assert(isequal(p,p_correct));
assert(abs(x-x_correct)<1E-5);
|
4 | Fail |
x = 0.5;
r = 0.999;
n = 5;
x_correct = 0.06248;
[p, x] = f(x, r, n);
assert(isequal(p(1:3),[-16384 65536 -98304]));
assert(abs(x-x_correct)<1E-5);
|
5 | Fail |
x = 0.5;
r = 0.999;
n = 6;
x_correct = 0.23407;
[p, x] = f(x, r, n);
assert(abs(sum(p(1:3))+2.25485E10)<1E5);
assert(abs(x-x_correct)<1E-5);
|
6 | Fail |
x = 0.5;
r = 0.9999;
n = 7;
x_correct = 0.09891;
[p, x] = f(x, r, n);
assert(abs(sum(p))<1E5);
assert(abs(x-x_correct)<1E-5);
|
Project Euler: Problem 5, Smallest multiple
241 Solvers
Project Euler: Problem 16, Sums of Digits of Powers of Two
61 Solvers
Who knows the last digit of pi?
488 Solvers
1496 Solvers
173 Solvers