Cody

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

Solution 1961975

Submitted on 6 Oct 2019 by Nikolaos Nikolaou
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 = 3

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

y = 1.7281e+09

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

y = 1.7663e+09

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

y = 65

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

y = 1.3008e+13

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

y = 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 = 19 y = 9 y = 11 y = 19 y = 99 y = 31 y = 251 y = 9 y = 19 y = 21 y = 11 y = 6499 y = 71 y = 49 y = 721 y = 339 y = 161 y = 52021 y = 99