A farmer and his trees
Source: 2009 SDMO Middle School Problem 1
August 24, 2016
Problem Statement
A farmer buys a batch of trees, which he wishes to plant in a square grid. For example, if he had trees, then he could plant them as shown below.[asy]
size(3cm,0);
dot((0,0));
dot((0,1));
dot((0,2));
dot((0,3));
dot((0,4));
dot((1,0));
dot((1,1));
dot((1,2));
dot((1,3));
dot((1,4));
dot((2,0));
dot((2,1));
dot((2,2));
dot((2,3));
dot((2,4));
dot((3,0));
dot((3,1));
dot((3,2));
dot((3,3));
dot((3,4));
dot((4,0));
dot((4,1));
dot((4,2));
dot((4,3));
dot((4,4));
[/asy]However, the farmer finds that he cannot plant his trees in a square grid. If he had more trees, or if he had fewer trees, then he could plant his trees in a square grid. How many trees did the farmer buy?