Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
% Updated test suite to remove trivial solutions;
% Small
Vmin = 10; Vmax = 55;
denom = floor(unique(egyptian_fraction(Vmin,Vmax)));
egyptian_value = sum(1./denom);
rel_tol = Vmin/Vmax*1e-6;
actual_error = abs( egyptian_value - Vmin/Vmax );
assert(isequal(actual_error < rel_tol ,true))
o =
[]
o =
6
q1 =
330
p =
5
d =
5
q =
66
p =
1
o =
6 66
|
2 | Pass |
% Pie
Vmin = 113; Vmax = 355;
denom = floor(unique(egyptian_fraction(Vmin,Vmax)));
egyptian_value = sum(1./denom);
rel_tol = Vmin/Vmax*1e-6;
actual_error = abs( egyptian_value - Vmin/Vmax );
assert(isequal(actual_error < rel_tol ,true))
o =
[]
o =
4
q1 =
1420
p =
97
d =
1
q =
1420
p =
97
o =
4 15
q1 =
21300
p =
35
d =
5
q =
4260
p =
7
o =
4 15 609
q1 =
2594340
p =
3
d =
3
q =
864780
p =
1
o =
4 15 609 864780
|
3 | Pass |
% Ramanujan
Vmin = 1023; Vmax = 1729;
denom = floor(unique(egyptian_fraction(Vmin,Vmax)));
egyptian_value = sum(1./denom);
rel_tol = Vmin/Vmax*1e-6;
actual_error = abs( egyptian_value - Vmin/Vmax );
assert(isequal(actual_error < rel_tol ,true))
o =
[]
o =
2
q1 =
3458
p =
317
d =
1
q =
3458
p =
317
o =
2 11
q1 =
38038
p =
29
d =
1
q =
38038
p =
29
o =
2 11 1312
q1 =
49905856
p =
10
d =
2
q =
24952928
p =
5
o =
2 11 1312 4990586
q1 =
1.2453e+14
p =
2
d =
2
q =
6.2265e+13
p =
1
o =
1.0e+13 *
0.0000 0.0000 0.0000 0.0000 6.2265
|
4 | Pass |
% E
Vmin = 27; Vmax = 183;
denom = floor(unique(egyptian_fraction(Vmin,Vmax)));
egyptian_value = sum(1./denom);
rel_tol = Vmin/Vmax*1e-6;
actual_error = abs( egyptian_value - Vmin/Vmax );
assert(isequal(actual_error < rel_tol ,true))
o =
[]
o =
7
q1 =
1281
p =
6
d =
3
q =
427
p =
2
o =
7 427 854 1281 2562
|
Make the vector [1 2 3 4 5 6 7 8 9 10]
29448 Solvers
1208 Solvers
Is my wife right? Now with even more wrong husband
1145 Solvers
Numbers with prime factors 2, 3 and 5.
113 Solvers
How many trades represent all the profit?
460 Solvers