Cody

Solution 1938662

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

ans = logical 1 D: 2, x: 3, y: 2

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

ans = logical 0 D: 151, x: 498062163, y: 40531724

Assertion failed.

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

ans = logical 0 D: 61, x: 335159612, y: 42912791

Assertion failed.

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

ans = logical 1 D: 66, x: 65, y: 8

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

ans = logical 0 D: 12000, x: 1954527133, y: 17842310

Assertion failed.

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

ans = logical 1 D: 2345, x: 15129001, y: 312420

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

ans = logical 1 D: 10, x: 19, y: 6 ans = logical 1 D: 20, x: 9, y: 2 ans = logical 1 D: 30, x: 11, y: 2 ans = logical 1 D: 40, x: 19, y: 3 ans = logical 1 D: 50, x: 99, y: 14 ans = logical 1 D: 60, x: 31, y: 4 ans = logical 1 D: 70, x: 251, y: 30 ans = logical 1 D: 80, x: 9, y: 1 ans = logical 1 D: 90, x: 19, y: 2 ans = logical 1 D: 110, x: 21, y: 2 ans = logical 1 D: 120, x: 11, y: 1 ans = logical 1 D: 130, x: 6499, y: 570 ans = logical 1 D: 140, x: 71, y: 6 ans = logical 1 D: 150, x: 49, y: 4 ans = logical 1 D: 160, x: 721, y: 57 ans = logical 1 D: 170, x: 339, y: 26 ans = logical 1 D: 180, x: 161, y: 12 ans = logical 1 D: 190, x: 52021, y: 3774 ans = logical 1 D: 200, x: 99, y: 7