Cody

Solution 2578245

Submitted on 18 Jun 2020
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
filetext = fileread('fifth_root.m'); assert(isempty(strfind(filetext, '^')),'^ forbidden') assert(isempty(strfind(filetext, 'power')),'power() forbidden') assert(isempty(strfind(filetext, 'mpower')),'mpower() forbidden') assert(isempty(strfind(filetext, 'realpow')),'realpow() forbidden') assert(isempty(strfind(filetext, 'nthroot')),'nthroot() forbidden') assert(isempty(strfind(filetext, 'roots')),'roots() forbidden')

^ forbidden

2   Pass
n = 1/9765625; assert(abs(fifth_root(n)-1/25)<1e-5)

f = 6.5536e-12 f = 2.5600e-06 f = 0.0016 f = 0.0400

3   Pass
n = 1/5555; assert(abs(fifth_root(n)-0.178263811215444)<1e-5)

f = 1.0198e-06 f = 0.0010 f = 0.0318 f = 0.1783

4   Pass
n = 1/3125; assert(abs(fifth_root(n)-1/5)<1e-5)

f = 2.5600e-06 f = 0.0016 f = 0.0400 f = 0.2000

5   Pass
n = 1/125; assert(abs(fifth_root(n)-0.380730787743176)<1e-5)

f = 4.4151e-04 f = 0.0210 f = 0.1450 f = 0.3807

6   Pass
n = 1/5; assert(abs(fifth_root(n)-0.724779663677696)<1e-5)

f = 0.0761 f = 0.2759 f = 0.5253 f = 0.7248

7   Pass
n = 1; assert(abs(fifth_root(n)-1)<1e-5)

f = 1 f = 1 f = 1 f = 1

8   Pass
n = 5; assert(abs(fifth_root(n)-1.37972966146121)<1e-5)

f = 13.1326 f = 3.6239 f = 1.9037 f = 1.3797

9   Pass
n = 25; assert(abs(fifth_root(n)-1.90365393871588)<1e-5)

f = 172.4662 f = 13.1326 f = 3.6239 f = 1.9037

10   Pass
n = 50; assert(abs(fifth_root(n)-2.18672414788656)<1e-5)

f = 522.8198 f = 22.8653 f = 4.7818 f = 2.1867

11   Pass
n = 500; assert(abs(fifth_root(n)-3.46572421577573)<1e-5)

f = 2.0814e+04 f = 144.2700 f = 12.0112 f = 3.4657

12   Pass
n = 3125; assert(abs(fifth_root(n)-5)<1e-5)

f = 3.9063e+05 f = 625.0000 f = 25.0000 f = 5

13   Pass
n = 759375; assert(abs(fifth_root(n)-15)<1e-5)

f = 2.5629e+09 f = 5.0625e+04 f = 225.0000 f = 15.0000

14   Pass
n = 9765625; assert(abs(fifth_root(n)-25)<1e-5)

f = 1.5259e+11 f = 3.9063e+05 f = 625.0000 f = 25.0000

15   Pass
n = 312500000; assert(abs(fifth_root(n)-50)<1e-5)

f = 3.9063e+13 f = 6.2500e+06 f = 2.5000e+03 f = 50.0000

16   Pass
n = 75937500000; assert(abs(fifth_root(n)-150)<1e-5)

f = 2.5629e+17 f = 5.0625e+08 f = 2.2500e+04 f = 150.0000

17   Pass
n = 31250000000000; assert(abs(fifth_root(n)-500)<1e-5)

f = 3.9063e+21 f = 6.2500e+10 f = 2.5000e+05 f = 500.0000

18   Pass
n = 52658067346875; assert(abs(fifth_root(n)-555)<1e-5)

f = 9.0021e+21 f = 9.4879e+10 f = 3.0803e+05 f = 555.0000