Cody

Problem 44716. Counting Squares

Solution 2064630

Submitted on 20 Dec 2019 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
assert(isequal(Square(1),1))

li = 0 sq = 1

2   Pass
assert(isequal(Square(2),5))

li = 0 sq = 5

3   Pass
assert(isequal(Square(3),13))

li = 0 sq = 13

4   Pass
assert(isequal(Square(4),25))

li = 0 sq = 25

5   Pass
assert(isequal(Square(5),41))

li = 0 sq = 41

6   Pass
assert(isequal(Square(6),61))

li = 0 sq = 61

7   Pass
assert(isequal(Square(7),85))

li = 0 sq = 85

8   Pass
assert(isequal(Square(8),113))

li = 0 sq = 113

9   Pass
assert(isequal(Square(9),145))

li = 0 sq = 145

10   Pass
assert(isequal(Square(16),481))

li = 0 sq = 481

11   Pass
assert(isequal(Square(25),1201))

li = 0 sq = 1201

12   Pass
assert(isequal(Square(49),4705))

li = 0 sq = 4705

13   Pass
assert(isequal(Square(64),8065))

li = 0 sq = 8065

14   Pass
assert(isequal(Square(81),12961))

li = 0 sq = 12961

15   Pass
assert(isequal(Square(100),19801))

li = 0 sq = 19801

16   Pass
assert(isequal(Square(500),499001))

li = 0 sq = 499001

17   Pass
assert(isequal(Square(999),1994005))

li = 0 sq = 1994005

Suggested Problems

More from this Author18

Community Treasure Hunt

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

Start Hunting!