Problem 463. Looking for Squares

Solution 1706257

Submitted on 11 Jan 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
for n=4:6; sq=squares(n); assert(length(sq)==n) for k=1:n assert(sq(k)>0) assert(round(sqrt(sq(k)))==sqrt(sq(k))) end assert(round(sqrt(sum(sq)))==sqrt(sum(sq))) end

[Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In nchoosek (line 129) In squares (line 3) In ScoringEngineTestPoint1 (line 2) In solutionTest (line 3)]

Error using nchoosek (line 130) Maximum variable size allowed by the program is exceeded. Error in squares (line 3) s=nchoosek(ans,n); Error in Test1 (line 2) sq=squares(n);

Suggested Problems

More from this Author100