Cody

Solution 2578251

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   Fail
n = 1/9765625; assert(abs(fifth_root(n)-1/25)<1e-5)

f = 1.2089e-56 f = 1.0995e-28 f = 1.0486e-14 f = 1.0240e-07

Assertion failed.

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

f = 1.1029e-30 f = 1.0502e-15 f = 3.2406e-08 f = 1.8002e-04

Assertion failed.

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

f = 1.0995e-28 f = 1.0486e-14 f = 1.0240e-07 f = 3.2000e-04

Assertion failed.

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

f = 1.6777e-17 f = 4.0960e-09 f = 6.4000e-05 f = 0.0080

Assertion failed.

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

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

Assertion failed.

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

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

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

f = 390625 f = 625 f = 25 f = 5

Assertion failed.

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

f = 1.5259e+11 f = 390625 f = 625 f = 25

Assertion failed.

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

f = 3.9062e+13 f = 6250000 f = 2500 f = 50

Assertion failed.

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

f = 3.9062e+21 f = 6.2500e+10 f = 250000 f = 500

Assertion failed.

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

f = 9.0949e+27 f = 9.5367e+13 f = 9765625 f = 3125

Assertion failed.

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

f = 1.1057e+47 f = 3.3253e+23 f = 5.7665e+11 f = 759375

Assertion failed.

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

f = 8.2718e+55 f = 9.0949e+27 f = 9.5367e+13 f = 9765625

Assertion failed.

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

f = 9.0949e+67 f = 9.5367e+33 f = 9.7656e+16 f = 312500000

Assertion failed.

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

f = 1.1057e+87 f = 3.3253e+43 f = 5.7665e+21 f = 7.5938e+10

Assertion failed.

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

f = 9.0949e+107 f = 9.5367e+53 f = 9.7656e+26 f = 3.1250e+13

Assertion failed.

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

f = 5.9118e+109 f = 7.6888e+54 f = 2.7729e+27 f = 5.2658e+13

Assertion failed.