Cody

# Problem 42764. Find the next square number

Solution 2045024

Submitted on 4 Dec 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
n = 1; out = 4; assert(isequal(next_square(n),out));

m = 1 a = 1.4142

Unrecognized function or variable 'y'. Error in next_square (line 12) if length(y)==m Error in Test1 (line 3) assert(isequal(next_square(n),out));

2   Fail
n = [5 7 9]; out = [9 9 16]; assert(isequal(next_square(n),out));

m = 3 a = 2.4495 a = 3 y = 0 9 a = 3.4641 a = 3 y = 9 9 a = 3.4641 a = 3.8730 a = 3.4641 a = 3.8730 a = 4.2426 a = 3.8730 a = 4.2426 a = 4.5826 a = 4.2426 a = 4.5826 a = 4.8990 a = 4.5826 a = 4.8990 a = 5.1962 a = 4.8990 a = 5.1962 a = 5.4772 a = 5.1962 a = 5.4772 a = 5.7446 a = 5.4772 a = 5.7446 a = 6 y = 9 9 36

Assertion failed.

3   Fail
n = 10.^(1:5); out = [16 121 1024 10201 100489]; assert(isequal(next_square(n),out));

m = 5 a = 3.3166 a = 10.0995 a = 31.6702 a = 100.0200 a = 316.2357

Unrecognized function or variable 'y'. Error in next_square (line 12) if length(y)==m Error in Test3 (line 3) assert(isequal(next_square(n),out));

4   Fail
n = round(7.^(3:.5:8)); out = [361 961 2500 6400 16900 44521 118336 311364 824464 2181529 5769604]; assert(isequal(next_square(n),out));

m = 11 a = 18.5472 a = 30.1496 a = 49.0306 a = 79.7245 a = 129.6611 a = 210.8862 a = 343.0102 a = 557.9229 a = 907.4977 a = 1.4761e+03 a = 2.4010e+03

Unrecognized function or variable 'y'. Error in next_square (line 12) if length(y)==m Error in Test4 (line 3) assert(isequal(next_square(n),out));