Finding the smallest grid of squares [closed]

Inspiration from Puzzling.SE.

Suppose we have an m × n grid such that each element is a base 10 digit. We can read the numbers from such a grid so that we fix a starting element, go to one of the eight nearest coordinates and maintain that direction for zero to five steps. This allows you to read a one to five digit number from a grid if you concatenate the digits.

Your task is to write a program finding the smallest m × n grid from which the squares of the numbers 1 to 100 (inclusive) can be read.

For example, if the grid is:

00182
36495


then the squares of 1-10 can be read from it, but, for example, 121 is missing. In this rectangle m × n = 2 × 5 = 10.

The winner is the code which generates the smallest grid.

closed as unclear what you're asking by Peter Taylor, Luis Mendo, Stewie Griffin, xnor, ETHproductionsDec 13 '15 at 1:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Please write it up as a separate problem here, instead of just posting a link. – Timwi Dec 12 '15 at 16:33
• Welcome to Programming Puzzles and Code Golf! As it currently stands, this question is not a valid challenge as outlined in the help center. Please edit your question to those specifications and next time, please Use The Sandbox before posting. – cat Dec 12 '15 at 16:41
• There are at least two things which are unclear: 1. The definition of which numbers are contained in the grid; 2. The tie-breaker to distinguish between brute-force programs which are guaranteed to generate the smallest grid (although they might not actually do so in any reasonable time). – Peter Taylor Dec 12 '15 at 19:19
• How can you read the digits? In a straight line? Orthogonally? Diagonally? Forwards? Backwards? Snaking? – xnor Dec 12 '15 at 22:35
• I think I could probably rewrite the question to clarify the definition of the numbers in the grid, but that wouldn't fix the problem of the winning condition. "The one which generates the smallest grid" is perfectly clear, but also almost entirely useless, because the most likely case is that every single answer submitted would be optimal, so they would all be "winners". – Peter Taylor Dec 14 '15 at 11:56