MathsReadCompetitive mathematics
Pattern recognition · integer answerhard20 min

All squares in a large grid

Grid Square Counting

A square board is divided into a 50×50 array of unit-square cells. How many axis-aligned squares of every possible size are contained in the board? Count every 1×1, 2×2, 3×3, ..., 50×50 square. Exclude rotated squares. A 2×2 board contains 5 qualifying squares in total. Submit one integer.

Learning goal: Generalise visual square placements across every possible square 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

For a k×k square, count the horizontal and vertical placements.

Hint 2

In a 50×50 board, a k×k square has (51−k)² placements.

Hint 3

Add the counts for k=1 through 50 using the sum-of-squares formula.

Common mistake to avoid

Counting only the 50² unit cells or omitting the largest square.

How to approach this problem

For each possible side length k, count the horizontal and vertical placements independently. Sum the products over all lengths.

Worked example with different values

A 4×4 board contains 16+9+4+1=30 axis-aligned squares.

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 →