New results for the Mondrian art problem

The Mondrian problem consists of dissecting a square of side length $n\in \NN$ into non-congruent rectangles with natural length sides such that the difference $d(n)$ between the largest and the smallest areas of the rectangles partitioning the square is minimum. In this paper, we compute some bounds on $d(n)$ in terms of the number of rectangles of the square partition. These bounds provide us optimal partitions for some values of $n \in \NN$. We provide a sequence of square partitions such that $d(n)/n^2$ tends to zero for $n$ large enough. For the case of `perfect' partitions, that is, with $d(n)=0$, we show that, for any fixed powers $s_1,\ldots, s_m$, a square with side length $n=p_1^{s_1}\cdots p_m^{s_m}$, can have a perfect Mondrian partition only if $p_1$ satisfies a given lower bound. Moreover, if $n(x)$ is the number of side lengths $x$ (with $n\le x$) of squares not having a perfect partition, we prove that its `density' $\frac{n(x)}{x}$ is asymptotic to $\frac{(\log(\log(x))^2}{2\log x}$, which improves previous results.


Introduction
Let us consider a two-dimensional grid of dimensions n × n, for a given positive integer n. We want to partition the whole area of this grid by using only rectangles of different integer dimensions. Overlapping rectangles is not allowed, and once a rectangle of dimensions a × b has been used, we cannot use another one either with dimensions a × b or b × a (a ninetydegree rotation of the original rectangle). When the whole area of the grid has been filled by rectangles, we score it by computing the difference d(n) between the areas of the largest and the smallest rectangles. The Mondrian art problem is to find the smallest d(n) among all possible fillings of the grid. This problem is based on the artwork of the artist Piet Mondrian . In his famous paintings, Mondrian uses canvas tessellated by primary-colored rectangles. Paraphrasing O'Kuhn [5]: 'The idea of the puzzle is that an art critic has ordered Mondrian only to create paintings whose rectangles are all incongruent to one another and only have integer side lengths. Furthermore, he can only use a square canvas whose side length is also an integer. Aggravated, Mondrian still wants to create works whose areas of the rectangles are all as close as possible. The work contained in [5] is partial progress towards answering the question of whether d(n) can ever equal 0. Besides, optimal solutions for n ≤ 32 are given in Bassen [1] using an algorithmic approach. Similar problems, like the decomposition of a square into rectangles of minimal perimeter [4], have been studied before.

A mathematical model based on graph theory
The problem of dissecting rectangles into squares was considered by Brooks, Smith, Stone, and Tutte in [2]. Although this problem is quite different from the Mondrian problem, its modeling in terms of graphs can be conveniently adapted here. For every squared grid of side length n completely filled with non-overlapping rectangles R i of dimensions a i × b i , for i ∈ {1, . . . , k}, we associate a graph G = (V, A, ω) in the following way: the vertices of G are the horizontal line segments on the squared grid, consisting of a set of horizontal sides of the rectangles R i , sides that we denote by P 0 , P 1 , . . . , P n , where P 0 and P n are the upper and lower segments of the squared grid. Every rectangle R i lies between two horizontal lines. Hence, the arcs of G are precisely the rectangles of the squared grid, that is, A = {R 1 , R 2 , . . . , R k }. We also define the weight of an arc as the dimensions of the given rectangle ω(R i ) = (a i , b i ) (see Figure 1 for an example).
Any graph obtained from a rectangle partition of a given square has nice properties. This type of graph is called an electrical network because its properties can be described in electrical terms (Kirchoff's law, Ohm's law, etc.). Since this mathematical model of the problem is reversible, that is, every rectangle partition of a square can be obtained from an electrical  network, we have a different approach to the problem that could be of some help to make progress. Nevertheless, we do not follow this line of research, but we think it is worth mentioning it here.
We organize this paper as follows. In the following section, we provide exact values of the defect d k (n) for any partition with a small number of given rectangles k. We show that optimal Mondrian partitions for squares of side length 3, 5 and 9 are obtained using exactly 3 rectangles. A general Mondrian partition of the square is provided in Section 3. This construction also shows that the defect ratio d(n)/n 2 tends to zero when n → ∞. Finally, section 4 deals with perfect Mondrian partitions, that is, those partitions with defect zero. It is shown that the density of those extremal partitions tends to zero and, in fact, they do not exist when n is the product of at most four different prime numbers.

Bounds on d(n) and optimal partitions
Giving a rectangle partition of a square of side n, we say that this partition is optimal if it has minimum defect d(n) among all possible rectangle partitions of the square. In particular, if d(n) = 0 for some partition, then such partition is called a perfect Mondrian partition. So far, the existence of perfect Mondrian partitions is unknown and the problem of finding optimal partitions seems to be very hard in general. At first sight, the computation of d(n) would require to make all possible partitions, which is devastating from a computational point of view. Besides, finding a direct calculation of d(n) (without such partitions) is a challenging question.
Another approach consists of finding upper bounds on d(n). In this section, we present an upper bound based on the number of rectangles of the partition. These upper bounds will be of some help to find optimal partitions for specific values of n. For any k ≥ 2, we define d k (n) as the minimum defect for all possible partitions of the square of side n using exactly k (non-congruent) rectangles. From its own definition, d(n) ≤ d k (n), and another way of calculating d(n) is The remaining content of this section is devoted to giving the exact values of d 2 (n) and d 3 (n). Later on, we will see that d 3 (n) gives the exact value of d(n) for n = 3, 5, and 9.
The value d 2 (n) is easy to compute. There is (up to a ninety-degree rotation) a unique partition of the square using two rectangles (see Figure  2 (a)). Let R i have dimensions a i × b i for i = 1, 2. In this situation, b 1 = b 2 = n and since R 1 is not congruent to R 2 (R 1 ∼ = R 2 ), we can choose a 1 > a 2 . Then, d 2 (n) = (a 1 − a 2 )n. Minimizing d 2 (n) is equivalent to find a 1 and a 2 such that a 1 − a 2 is minimum, and since they are positive integers satisfying a 1 + a 2 = n, the solution is (a 1 , a 2 ) = ( n 2 + 1, n 2 − 1) whenever n is even, and (a 1 , a 2 ) = ( n+1 2 , n−1 2 ) otherwise. That is, The calculation of d 3 (n) needs a deeper analysis. We perform it in the following result.
Proposition 2.1. Given any positive integer n ≥ 3, n + 1 3 (n + 2) if n ≡ 4 (mod 6), n − 1 6 (n + 1) if n ≡ 5 (mod 6). (2) Proof. There are two types of square partitions using three rectangles (up to rotations and/or symmetries). They are depicted in Figure 2 (b) and (c). The partition depicted in case (b) can be analyzed using a similar argument to the one given above for two rectangles. For this type of partition, the defect is 3n when n ≡ 0 (mod 3). Otherwise, the defect is even larger. However, we focus on partitions of type (c) since it gives a lower defect than a partition of type (b) for any n, and as a consequence, it produces the values of d 3 (n). Let (a i , b i ) be the dimensions of R i , for i = 1, 2, 3. Then, b 1 = b 2 + b 3 = n and a 1 + a 2 = a 1 + a 3 = n. Since R 2 ∼ = R 3 , without loss of generality, we can choose b 2 > b 3 . In this case, we proceed as we did with the case k = 2. The dimensions b 2 and b 3 to get the minimum value of A(R 2 ) − A(R 3 ) (the difference of the areas of R 2 and R 3 ) are given by Notice that the area of R 1 must interlace A(R 2 ) and A(R 3 ) to get d 3 (n) since, otherwise, the defect of the square would be larger. Moreover, since we look for the largest a 1 satisfying A(R 3 ) ≤ A(R 1 ) ≤ A(R 2 ). We divide this problem depending on the parity of n: Equation (3), we obtain To get the largest integer value of a 1 satisfying Equation (5), we write n = 6l + p, where p ∈ {0, 2, 4}. Replacing it in (5), we obtain It is easy to see that the unique integer value satisfying both inequalities is a 1 = 2l for p = 0, and a 1 = 2l + 1 for p = 2 or p = 4. However, since A(R 2 ) − A(R 3 ) = 2(n − a 1 ) (see Equation (4)), we compute d 3 (n) using the unique value for a 1 obtained as a solution of (5). Hence, for p = 0, we get d 3 (n) = 2(6l − 2l) = 6l + 2l = n + 1 3 n. Besides, d 3 (n) = 2(2l + 2 − (2l + 1)) = n + 1 3 (n − 2) for p = 2 and, for the last case p = 4, we obtain d 3 (n) = n + 1 3 (n + 2).
Equation (3), we get Again, we write n as 6l + p, where p ∈ {1, 3, 5}. Replacing it in (6), we get As in the previous case, the unique value for a 1 satisfying Equation for this case, we obtain the corresponding value for d 3 (n) given in Equation (2). The cases p = 1 and p = 5 have no solution for a 1 satisfying both inequalities and they need a different analysis.
We would like to remark that the previous proof is constructive, that is, it provides, for any n, the optimal partitions of a square of side length n using 3 rectangles. Figure 3 shows these optimal partitions for odd n.
A simple comparison between Equations (1) and (2) shows that d 3 (n) < d 2 (n), for any n (see also Figure 4), that is, any optimal partition using three rectangles provides a smaller defect than any optimal partition with two squares. This is something that one can expect. But, on the other side, this monotonicity property does not continue beyond this point. Optimal partitions using just three rectangles appear for some values of n, namely n = 3, 5, and 9. We will prove this result with the help of the next lemma. Lemma 2.1. Let us consider a partition of a square of side length n, for n ≥ 3, with defect δ using k rectangles. Let m be the minimum area of such k rectangles. Then, it holds that Proof. Let A(R i ) be the area of the rectangles of the partition, where 1 ≤ i ≤ k. There is at least one rectangle with area m, let us say R 1 , and since the defect is δ, there is at least one other rectangle, let us say R k , with area m + δ. The remaining rectangles .
A simple rearrangement of the previous formula gives the desired result.
Proposition 2.2. There are optimal partitions of a square of side length n using exactly three rectangles for n = 3, 5 and 9, that is, d(n) = d 3 (n) for n = 3, 5, and 9.
Proof. Let us suppose that we have a partition of a square of side length n using k rectangles, where k ≥ 4, and such that d k (n) < d 3 (n), for n = 3, 5, and 9. We will derive a contradiction. Moreover, for n = 3 and 5, we will prove that even d k (n) ≤ d 3 (n) is also impossible, showing that optimal partitions for n = 3 and 5 only happen with 3 rectangles.
• Case n = 3. This case is trivial since there is no partition using k ≥ 4 non-congruent rectangles.
• Case n = 5. Let m be the minimum area of a partition using k rectangles (a k-partition for short), with k ≥ 4. By Lemma 2.1, we have that m ≤ 25−d k (5) k ≤ 25 4 = 6. This means that a k-partition contains, as a tile of minimum area, one of these tiles: 1 × 1, 1 × 2, 1 × 3, 1 × 4, 2 × 2, 1 × 5, or 2 × 3. We derive a contradiction in the case m ≤ 3. Indeed, the maximum area of a tile would be at most m + d k (5) ≤ m + d 3 (5) = m + 4 (see Equation (2)). If we considered all the available tiles with areas between these values, we would not sum up to 5 2 = 25. If m = 4, the available tiles for this k-partition are: 1 × 4, 2 × 2, 1 × 5, 2 × 3, and 2 × 4 (since the maximum allowed area is 8). No k(≥ 4) combination of these tiles sums up to 25. If m = 5, the tile of dimensions 1 × 5 belongs to the k-partition. But since the maximum area of a tile would be 9, in this case, the available tiles would be 1 × 5, 2 × 3, 2 × 4, and 3 × 3. Since k ≥ 4, all of them would perform the partition, but their corresponding areas sum up to 28. Finally, if m = 6, there are just four available tiles with dimensions 2 × 3, 2 × 4, 3 × 3, and 2 × 5. Their corresponding areas sum up to more than 25.
• Case n = 9: Assume that there is a k-partition (k ≥ 4) with defect d k (9) < d 3 (9) = 6. By Lemma 2.1, we have that a tile of minimum area m satisfies m ≤ 81 4 ≤ 20. There are no tiles of areas m = 11, 13, 17, 19 fitting in the 9 × 9-square. For any m < 12 or m = 18, it is easy to show that the sum of the areas of all available tiles (those with areas between m and m + 5) do not reach 9 2 . The remaining values of m need a specific argument: m = 12: The available tiles are 2 × 6, 3 × 4, 2 × 7, 3 × 5, 2 × 8, and 4 × 4. Their areas sum up to 85, and the minimum area of a tile is 12. So, there is no possibility that k of them, for k ≥ 4, give a partition of a 9 × 9-square.
m = 14: The available tiles are 2 × 7, 3 × 5, 2 × 8, 4 × 4, 2 × 9, and 3 × 6. Their areas sum up to 97. But notice that the tile 2 × 9 needs a tile of dimensions 1 × s, for some s ≥ 1, to complete a perfect partition. Since there is no tile of dimensions 1 × s, we must remove the tile 2 × 9 from the set of available tiles. But, then, the areas of the available tiles sum up to less than 81. m = 20: The available tiles, in this case, are 4 × 5, 3 × 7, 4 × 6, 3 × 8, and 5 × 5. Their areas sum up to 117, and no combination of four of them gives a total area of 81.

A general construction
Instead of considering the 'absolute defect' d(n), which is a difference between areas, it makes sense also to study the 'relative defect' or defect ratio, defined as ρ(n) = d(n)/n 2 . Here we show that, for n large enough, there exist partitions of the square of side length n with ρ(n) < for any > 0.
Proposition 3.1. For any natural number r ≥ 3, there exists a partition of the square of side length n = k! 2 , where k = 2r + 1, using k rectangles such that the defect ratio ρ(n) → 0 when r → ∞.
Proof. Given n = k! 2 , let us consider the rectangles R 1 , R 2 , R 3 , . . . , R k inside the square following a 'spiral' pattern starting from R 1 in the basis of the square and ending in the center of the square (see Figure 5 as an example for k = 7). The idea of this proof is as follows: R 1 is obtained as a 1/k part of the square, R 2 as a 1/(k − 1) part of the rest, R 3 as a 1/(k − 2) part of the rest, and so on. The dimensions a i × b i of the rectangle R i are given in Table 3, for all i = 1, 2, . . . , k.

Rectangle
1st side length 2nd side length First, notice that every rectangle dimension is indeed a natural number.
Moreover, the first k − 2 rectangles have the same area, that is, and the last two rectangles have area . As a consequence

On perfect Mondrian partitions
Here we investigate the possible existence of perfect Mondrian partitions. In this context, O'Kuhn [5] proved that, given x > 3, the number of  side lengths n(x) ≤ x of squares not having such a partition, that is, n(x) = |{n ≤ x : d(n) = 0}|, satisfies a lower bound of the order where C ≈ 1 e 2γ log (2) , and γ = 0.577215665 . . . is the constant of Euler-Mascheroni.
We prove another similar bound by giving some necessary conditions for the existence of the Mondrian partitions with zero defect. Although our techniques are very simple, the obtained bound overcomes O'Kuhn's one, as we will see later.
Theorem 4.1. Let N (s 1 , . . . , s m ) be the set of integers of the form n = p s 1 1 · · · p sm m , where p 1 < · · · < p m are some primes with fixed powers s 1 , . . . , s m .
(i) For any given s 1 , . . . , s m , there is a constant c such that, if p 1 > c, then no square S with side length n ∈ N (s 1 , . . . , s m ) has a perfect Mondrian partition.
(ii) There is no perfect Mondrian partition of a square S with side length n a primer power (n ∈ N (s 1 )).
(iv) There is no perfect Mondrian partition of a square S with side length n being a product of 2 or 3 primes.
Proof. We start by proving (ii) since it is a special case. Let S be a square of side length n = p s , with p a prime, having a perfect Mondrian partition P with k (non-congruent) rectangles R 1 , . . . , R k . Then, A(S) = p 2s and, since the partition is perfect, k must divide n. So, we can write k = p r for some integer r ≤ 2s. Moreover, the area of each rectangle is A(R i ) = n 2 k = p 2s−r for i = 1, . . . , k. Now, since the partition is Mondrian, all the sides x i , y i of the rectangles must be different, and of the form x i = p σ i and y i = p τ i with σ i + τ i = 2s − r for i = 1, . . . , k. Furthermore, such sides cannot be larger than the side n = p s of S. Thus, the total number of 'available' squares is the number ) if r is odd. So, K = r+2 2 if r is even; and K = r+1 2 if r is even. Then, from k ≤ K, we get the inequalities p r ≤ r + 2 2 if r is even, and p r ≤ r + 1 2 if r is odd.
But such inequalities are not satisfied for any p ≥ 2 and r ≥ 2, so that there is no perfect Mondrian partition of a square with side a prime power.
Now, let us prove the more general case (i). Let S be a square of side length n = p s 1 1 · · · p sm m , with primes p 1 < · · · < p m , and let s = max{s 1 , . . . , s m }. As before, assume that S has a perfect Mondrian partition P = {R 1 , . . . , R k }. Now, A(S) = p 2s 1 1 · · · p 2sm m and, as the partition is perfect, k must divide n. Then, let k = p r 1 1 · · · p rm m for some integers r i ≤ 2s i , for i = 1, . . . , m, and the area of each rectangle is constant, namely A(R j ) = n 2 k = p 2s 1 −r 1 1 · · · p 2sm−rm m for j = 1, . . . , k. Again, all the sides x j , y j of the rectangles must be different, with x j y j = A(R j ), and x j , y j ≤ n. Let us see that the total number K of 'available' squares satisfies the bound if m i=1 (s i − r i + 1) > 1, and otherwise. Indeed, the first term in (9)-(10) stands for all the possible pairs (x j , y j ) such that x j = p 2s 1 −r 1 1 · · · p 2sm−rm m with r i ∈ {0, . . . , 2s i − r i }, for i = 1, . . . , m (note that the total number of such r i is 2s i −r i +1). But, since each x j must not be larger than n = p s 1 1 · · · p sm m , the second term in (9), if it is at least 2, it means that we can subtract all the values x j = p t 1 1 · · · p tm m with t i ∈ {s i , . . . , 2s i − r i } for i = 1, . . . , m (the number of such t i is s i − r i + 1) in all cases except for one. This exception is for the case t i = r i for i = 1, . . . , m (that is, x j = p s 1 1 · · · p sm m = n), which justifies the last term +1 in (9). Now, on the one hand, we have that the number k(> 1) of rectangles satisfies k ≥ |N (1, 0, . . . , 0)| = p 1 (since p 1 < . . . < p m ), and, on the other hand, the maximum number of available rectangles, with r 1 = 1 and r 2 = · · · = r m = 0, satisfies (since s ≥ s i for i = 1, . . . , m ). Consequently, if k ≥ p 1 > K ≥ K, we have a contradiction and S cannot have a perfect Mondrian partition.
In particular, notice that, by taking s 1 = · · · = s m = 1, the bound (11) becomes but, as we will see next, a more precise analysis can be done.
With this aim, note that, in this case, n = p 1 p 2 · · · p m . If the number of rectangles is the minimum k = p 1 , then the area of each rectangle is A(R j ) = x j y j = p 1 p 2 2 · · · p 2 m for j = 1, . . . , m, with x j , y j ≤ p 1 p 2 · · · p m . Now, all the possible pairs (x j , y j ) are 2·3 m−1 /2 = 3 m−1 , as expected from (12). To this quantity, we can subtract all the values x j = p t 1 1 · · · p tm m with t 1 ∈ {0, 1}, t j ∈ {0, 1, 2} for j = 2, . . . , m such that t 1 + · · · + t m ≥ m and with the condition that, if t i = 0 for some i, there is at least one j > i such that j = 2 (excepting the case t 1 = · · · = t m = 1). Alternatively, the second condition is equivalent to require that the partial sums t 1 + · · · + t i , for i = 1, . . . , m, reach their maximum at i = m. Note that, since p 1 < p 2 < · · · < p m , each of such n-tuples (t 1 , . . . , t m ) satisfies p t 1 1 · · · p tm m > n, as required. At this point, it is useful to characterize each possible m-tuple as an m-path in a grid with integer points, starting from (0, 0), and using i- The good news is that this is a known sequence of the numbers, corresponding to the so-called Moztkin paths. In the On-line Encyclopedia of Integer Sequences [6], this is the sequence A025566, where the following formula is provided (starting from m = 1 instead of m = 0, as it is presented in [6]): To prove that the number of our m-tuples (t 1 , . . . , t m ) coincides with a(m) is better to look at a related sequence that also appears in [6], labeled with A005773. Namely, for m = 1, 2, .
For example, the paths for m = 3, 4 are shown in Figure 6. Comparing the sequences (13) and (15), the reader can note that a(m) = b(m + 1) − b(m).
The reason for this is clear if, for instance, we look at Figure 6. Our paths representing the desired m-tuples, say (t 1 , t 2 , t 3 ) (m = 4), are those of Figure  6 (b), not ending with the step U , and looked 'upside down' (those drown in bold line). Besides, the other paths, after removing their last step U are in correspondence with those of 6 (a). Summarizing, we proved that a(m) = b(m + 1) − b(m) is the number we are looking for (of course, this equality can be checked by using (14) and (16).) Thus, for any square S with side n = p 1 · · · p m , where p 1 < · · · < p m , we conclude that, if where the last one stands for the available case x i = p 1 · · · p m , then S has not a perfect Mondrian dissection with k ≥ p 1 rectangles.
Finally, let us prove (iv). The case of s = 2 primes follows immediately from (ii) and (iii). For the case of s = 3, the same lines of reasoning allow us to prove the following.
• If k ≥ p 1 > 8, there is no perfect Mondrian partition of a square S with side length n = p 2 1 p 2 , that is, n ∈ N (2, 1).
• If k ≥ p 1 > 6, there is no perfect Mondrian partition of a square S with side length n = p 1 p 2 2 , that is, n ∈ N (1, 2). Indeed, for instance, in the first case, A(S) = p 4 1 p 2 2 and, if k = p 1 , then A(R i ) = p 3 1 p 2 2 . Thus, the number of possible side lengths is 4 · 3 − 4 = 8 (since the four sides p 1 p 2 2 , p 2 1 p 2 2 , p 3 1 p 2 , and p 3 1 p 2 2 are not allowed because they are greater than n). Thus, (iv) follows again from the referred results in [3].
Let us see a consequence of our approach. Following the conventional notation, let π s (n) be the number of integers not greater than n, with exactly s prime divisors (not necessarily distinct). Such numbers are usually called s-almost primes. For instance, every number in N (s 1 , . . . , s m ) is an s-almost primes with s = s 1 + · · · + s m . A classic result of Landau states that π s (n) is asymptotic to π s (n) ∼ n log n (log(log(n))) s−1 (s − 1)! , see, for instance, Tenenbaum [7].
Corollary 4.1. Let n(x) be the number of side lengths at most x of squares not having such a partition, as before. Then, its 'density' n(x)/x is asymptotic to n(x) x ∼ (log(log(x))) 2 2 log(x) .
Proof. By Theorem 4.1 (iv), we know that there is no perfect Mondrian partition of a square S of side n being the product of s(≤ 3) primes (not necessarily distinct). Then, by using (18), the number n(x) of such squares, with side n ≤ x, is asymptotic to x log x (log(log(x))) s−1 (s − 1)! , and the result follows by considering the term of the greatest order (with s = 3).
For the sake of comparison, notice that the result of O'Kuhn in (8) corresponds to take only the first two terms (for s = 1, 2) of the sum in (19).