Puzzle: Find all values of N for which one can dissect a square into N smaller squares, and outline an algorithm for doing such a dissection.
Solution: The basic point to observe is a square has 4 rightangles. So, to divide it into smaller squares each of its rightangle must fall into another square, as more than one rightangle together will result in a nonsquare figures.
Now, consider the following cases:
 When N = 2, 3, or 5: No such division is possible, as it violates the above given condition and nonshaped figures are obtained.

When N = 4: This is the easiest case. Just divide the square horizontally and vertically, from the centre. The resulting figure will have 4 squares.

When N is even and greater than 4: This case can be generalised by considering N = 2k and forming 2k – 1, equal squares along adjacent sides of the given square. However, the side length of each smaller square should be equal to 1/k of the length of the given square.
For example: Consider the example when N = 6 as shown in the figure, here we have formed 5 squares along the top and rightside, each of side (1/3)rd of the side of the original square. Also, a square of side (2/k) is left, resulting in a total of 6 squares.

Case N is odd and greater than 5: This case builds upon the solution for even values of N. If N is odd, we can break it as N = 2k + 1, which further can be written as N = 2(k – 1) + 3. Now, we can first form 2(k – 1) squares using the above approach, and then divide, on of the obtained squares, into four smaller squares, which will increase the overall square count by 3.
For example: Consider the example when N = 9 as shown. Here, we first form 6 squares, and then divided the topleft square into 4 smaller squares, to get total 9 squares.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a studentfriendly price and become industry ready.
Recommended Posts:
 Ways of dividing a group into two halves such that two elements are in different groups
 Dividing the rectangle into n rightangled triangles
 Puzzle  Divide a Square into 5 parts such that 4 parts among them are equal
 Previous perfect square and cube number smaller than number N
 Square pyramidal number (Sum of Squares)
 Find the side of the squares which are lined in a row, and distance between the centers of first and last square is given
 Find the number of squares inside the given square grid
 Count squares of size K inscribed in a square of size N
 Puzzle  Program to find number of squares in a chessboard
 Puzzle  Can a Knight reach bottom from top by visiting all squares
 Puzzle  Three Squares
 Count number of digits after decimal on dividing a number
 Maximum value with the choice of either dividing or considering as it is
 Count of divisors having more set bits than quotient on dividing N
 Maximum sum after repeatedly dividing N by a divisor
 Minimum integer such that it leaves a remainder 1 on dividing with any element from the range [2, N]
 Minimize sum by dividing all elements of a subarray by K
 Count subarrays such that remainder after dividing sum of elements by K gives count of elements
 Largest number dividing maximum number of elements in the array
 Smallest number dividing minimum number of elements in the array  Set 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.