Cody

# Problem 42764. Find the next square number

Solution 1688112

Submitted on 6 Dec 2018 by Martin C.
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
n = 1; out = 4; assert(isequal(next_square(n),out));

y = [] y = 4

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

y = [] y = 9 y = 9 9 y = 9 9 16

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

y = [] y = 16 y = 16 121 y = 16 121 1024 y = 16 121 1024 10201 y = 16 121 1024 10201 100489

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

y = [] y = 361 y = 361 961 y = 361 961 2500 y = 361 961 2500 6400 y = 361 961 2500 6400 16900 y = 361 961 2500 6400 16900 44521 y = 361 961 2500 6400 16900 44521 118336 y = 361 961 2500 6400 16900 44521 118336 311364 y = 361 961 2500 6400 16900 44521 118336 311364 824464 y = 361 961 2500 6400 16900 44521 118336 311364 824464 2181529 y = 361 961 2500 6400 16900 44521 118336 311364 824464 2181529 5769604

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!