I've used continued fractions and this link for my solution https://math.stackexchange.com/questions/2215918/continued-fraction-of-sqrt67-4/2216011#2216011
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = 2; y_correct = 3; assert(isequal(Diophantine(x),y_correct))
|
2 | Pass |
x = 151; y_correct = 1728148040; assert(isequal(Diophantine(x),y_correct))
|
3 | Pass |
x = 61; y_correct = 1766319049; assert(isequal(Diophantine(x),y_correct))
|
4 | Pass |
x = 66; y_correct = 65; assert(isequal(Diophantine(x),y_correct))
|
5 | Pass |
x = 12000; y_correct = 13007560326001; assert(isequal(Diophantine(x),y_correct))
|
6 | Pass |
x = 2345; y_correct = 15129001; assert(isequal(Diophantine(x),y_correct))
|
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)))
|
Create a cell array out of a struct
508 Solvers
Getting the indices from a vector
3206 Solvers
Circular Primes (based on Project Euler, problem 35)
140 Solvers
531 Solvers
389 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!