# What is the smallest rectangle containing the squares of 1 through 100?

Let us suppose that we have an $m\times n$ grid such that every element is a digit in base $10$. Then we can read the numbers from a grid such that we fix a starting element and go to one of the eight nearest grid and maintain that direction. Or, to be precisely, you don't have to go to that direction any steps so you can also read the numbers $1, 4,9$. How small value $mn$ can be such that one can read the numbers $1^2,2^2,3^2,\ldots,100^2$ from the grid?

For example if the grid is

00182
36495


then one can read the squares $1^2,\ldots,10^2$ from it but for example $11^2=121$ is missing. In this rectange $mn=2\cdot 5=10$.

• How did you get 6 upvotes in two hours? – Deusovi Oct 19 '15 at 9:59
• @Deusovi Six people voted the question up within two hours of it being asked. – Samthere Oct 19 '15 at 14:02
• @Samthere: Generally, six people are not online before 5AM US time, and there was nearly no other activity happening. – Deusovi Oct 19 '15 at 14:33
• Can you reuse a digit as long as they're not consecutive? For example, would 12 satisfy 11^2=121? – dpwilson Oct 19 '15 at 15:32
• @dpwilson I'm pretty sure you'll have to be able to read each single number in a straight line, but each number can start anywhere and go in any one of 8 directions ("maintain that direction"). The clarification was that you can read a single digit (you don't have to take any steps). Being able to jump back is considerably simpler for this set of numbers, I think, but still limited by having only 8 movement options for a set of 10 possible digits. – Samthere Oct 19 '15 at 15:48

It is known that $mn\leq 121$; Solving a Recreational Square Packing Problem.

I'm not sure how much the result can be improved.

Example of 11x11 solution copied from the page above:

6 4 6 9 4 1 2 9 7 3 6
9 2 7 7 4 4 8 1 2 1 7
1 0 6 2 7 0 4 4 8 3 4
2 1 2 2 5 5 9 2 9 6 5
9 2 5 5 2 0 2 6 3 9 1
1 6 3 6 0 0 9 3 7 0 6
6 0 0 4 9 0 1 6 0 0 4
9 8 4 4 8 0 1 4 5 2 3
2 4 8 2 8 1 6 8 6 7 5
1 7 6 9 2 4 5 4 2 7 6
6 6 3 8 8 5 6 1 5 2 1