Cody

# Problem 1215. Diophantine Equations (Inspired by Project Euler, problem 66)

Solution 1938659

Submitted on 16 Sep 2019
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
x = 2; y_correct = 3; assert(isequal(Diophantine(x),y_correct))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in Diophantine (line 17) X^2-D*y^2==1 Error in Test1 (line 1) x = 2; y_correct = 3; assert(isequal(Diophantine(x),y_correct))

2   Fail
x = 151; y_correct = 1728148040; assert(isequal(Diophantine(x),y_correct))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in Diophantine (line 17) X^2-D*y^2==1 Error in Test2 (line 1) x = 151; y_correct = 1728148040; assert(isequal(Diophantine(x),y_correct))

3   Fail
x = 61; y_correct = 1766319049; assert(isequal(Diophantine(x),y_correct))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in Diophantine (line 17) X^2-D*y^2==1 Error in Test3 (line 1) x = 61; y_correct = 1766319049; assert(isequal(Diophantine(x),y_correct))

4   Fail
x = 66; y_correct = 65; assert(isequal(Diophantine(x),y_correct))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in Diophantine (line 17) X^2-D*y^2==1 Error in Test4 (line 1) x = 66; y_correct = 65; assert(isequal(Diophantine(x),y_correct))

5   Fail
x = 12000; y_correct = 13007560326001; assert(isequal(Diophantine(x),y_correct))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in Diophantine (line 17) X^2-D*y^2==1 Error in Test5 (line 1) x = 12000; y_correct = 13007560326001; assert(isequal(Diophantine(x),y_correct))

6   Fail
x = 2345; y_correct = 15129001; assert(isequal(Diophantine(x),y_correct))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in Diophantine (line 17) X^2-D*y^2==1 Error in Test6 (line 1) x = 2345; y_correct = 15129001; assert(isequal(Diophantine(x),y_correct))

7   Fail
j=[10:10:90 110:10:200]; v=arrayfun(@(x) Diophantine(j(x)),1:length(j)); y_correct=[19 9 11 19 99 31 251 9 19 21 11 6499 71 49 721 339 161 52021 99]; assert(all(isequal(v,y_correct)))

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in Diophantine (line 17) X^2-D*y^2==1 Error in Test7>@(x)Diophantine(j(x)) (line 1) j=[10:10:90 110:10:200]; v=arrayfun(@(x) Diophantine(j(x)),1:length(j)); Error in Test7 (line 1) j=[10:10:90 110:10:200]; v=arrayfun(@(x) Diophantine(j(x)),1:length(j));