Cody

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

Solution 3728328

Submitted on 19 Nov 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   Pass
x = 2; y_correct = 3; assert(isequal(Diophantine(x),y_correct))

y = 2 X = 3

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

y = 40531724 X = 498062163

Assertion failed.

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

y = 42912791 X = 335159612

Assertion failed.

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

y = 8 X = 65

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

y = 17842310 X = 1.9545e+09

Assertion failed.

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

y = 312420 X = 15129001

7   Pass
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)))

y = 6 X = 19 y = 2 X = 9 y = 2 X = 11 y = 3 X = 19 y = 14 X = 99 y = 4 X = 31 y = 30 X = 251 y = 1 X = 9 y = 2 X = 19 y = 2 X = 21 y = 1 X = 11 y = 570 X = 6499 y = 6 X = 71 y = 4 X = 49 y = 57 X = 721 y = 26 X = 339 y = 12 X = 161 y = 3774 X = 52021 y = 7 X = 99

Suggested Problems

More from this Author80

Community Treasure Hunt

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

Start Hunting!