Cody

# Problem 44344. The 5th Root

Solution 1687367

Submitted on 6 Dec 2018 by test test
• Size: 7
• This is the leading solution.
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   Pass
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')

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint2 (line 2) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint3 (line 2) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint4 (line 2) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint6 (line 2) In solutionTest (line 13)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint7 (line 2) In solutionTest (line 15)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint8 (line 2) In solutionTest (line 17)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint9 (line 2) In solutionTest (line 19)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint10 (line 2) In solutionTest (line 21)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint11 (line 2) In solutionTest (line 23)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint12 (line 2) In solutionTest (line 25)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint13 (line 2) In solutionTest (line 27)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint14 (line 2) In solutionTest (line 29)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint15 (line 2) In solutionTest (line 31)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint16 (line 2) In solutionTest (line 33)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint17 (line 2) In solutionTest (line 35)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In fifth_root (line 2) In ScoringEngineTestPoint18 (line 2) In solutionTest (line 37)]

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!