Cody

# Problem 45964. Compute the nth Pythagorean prime

Solution 3035998

Submitted on 2 Oct 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
n = 1; pp_correct = 5; [pp1,a1,b1] = PythagoreanPrime(n); assert(isequal(pp1,pp_correct)) assert(a1 == floor(a1) && b1 == floor(b1) && a1^2+b1^2 == pp1)

Output argument "b" (and maybe others) not assigned during call to "PythagoreanPrime". Error in Test1 (line 3) [pp1,a1,b1] = PythagoreanPrime(n);

2   Fail
n = 5; pp_correct = 37; [pp1,a1,b1] = PythagoreanPrime(n); assert(isequal(pp1,pp_correct)) assert(a1 == floor(a1) && b1 == floor(b1) && a1^2+b1^2 == pp1)

Output argument "b" (and maybe others) not assigned during call to "PythagoreanPrime". Error in Test2 (line 3) [pp1,a1,b1] = PythagoreanPrime(n);

3   Fail
n = 25; pp_correct = 257; [pp1,a1,b1] = PythagoreanPrime(n); assert(isequal(pp1,pp_correct)) assert(a1 == floor(a1) && b1 == floor(b1) && a1^2+b1^2 == pp1)

Output argument "b" (and maybe others) not assigned during call to "PythagoreanPrime". Error in Test3 (line 3) [pp1,a1,b1] = PythagoreanPrime(n);

4   Fail
n = 125; pp_correct = 1657; [pp1,a1,b1] = PythagoreanPrime(n); assert(isequal(pp1,pp_correct)) assert(a1 == floor(a1) && b1 == floor(b1) && a1^2+b1^2 == pp1)

Output argument "b" (and maybe others) not assigned during call to "PythagoreanPrime". Error in Test4 (line 3) [pp1,a1,b1] = PythagoreanPrime(n);

5   Fail
n = 625; pp_correct = 10313; [pp1,a1,b1] = PythagoreanPrime(n); assert(isequal(pp1,pp_correct)) assert(a1 == floor(a1) && b1 == floor(b1) && a1^2+b1^2 == pp1)

Output argument "b" (and maybe others) not assigned during call to "PythagoreanPrime". Error in Test5 (line 3) [pp1,a1,b1] = PythagoreanPrime(n);

6   Fail
n = 3125; pp_correct = 62497; [pp1,a1,b1] = PythagoreanPrime(n); assert(isequal(pp1,pp_correct)) assert(a1 == floor(a1) && b1 == floor(b1) && a1^2+b1^2 == pp1)

Output argument "b" (and maybe others) not assigned during call to "PythagoreanPrime". Error in Test6 (line 3) [pp1,a1,b1] = PythagoreanPrime(n);

7   Fail
n = 15625; pp_correct = 367229; [pp1,a1,b1] = PythagoreanPrime(n); assert(isequal(pp1,pp_correct)) assert(a1 == floor(a1) && b1 == floor(b1) && a1^2+b1^2 == pp1)

Output argument "b" (and maybe others) not assigned during call to "PythagoreanPrime". Error in Test7 (line 3) [pp1,a1,b1] = PythagoreanPrime(n);

### Community Treasure Hunt

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

Start Hunting!