MathsReadCompetitive mathematics
Pattern recognition · integer answermedium12 min

Squares on a grid

Grid Patterns

How many axis-aligned squares of all sizes can be drawn by choosing grid lines on a 9 by 9 grid of small unit squares? Submit one integer.

Learning goal: Count squares separately by size.

Look for the underlying structure rather than guessing the next number. Submit only the final integer; you can open hints below as needed.

Check your answer without signing in. Sign in to save your progress.

Accepted format: a whole number such as 42 or 123456789. No commas, formulas, or source code.

Hints

Hint 1

A square of side s has (10-s)^2 placements.

Hint 2

Sum over side lengths 1 through 9.

Hint 3

You will obtain 1²+2²+...+9².

Common mistake to avoid

Assuming the first visible step stays constant without testing the full pattern.

How to approach this problem

A square of side k can start in any of n−k+1 positions on either axis. Count each side length separately.

Worked example with different values

On a 3×3 board there are 9 unit squares, 4 side-two squares and one side-three square: 14 total.

Apply the same reasoning to the challenge. This example is a separate practice problem.

Learn the technique: Sequence patterns: differences, recurrences and interleaving

Report a question or explanation issue

Sequence patterns · Repeating remainders

Back to problems →