On sum of rectangles with size constraints

46 Views Asked by At

Let $n \in \mathbb{Z}$ and $m_1, m_2, \cdots, m_k$ be distinct primes $m_i \ge 5$ with $\sqrt n \lt \prod_i m_i$.

We can easily compute by brute force $a_i, p_i, b_i, r_i$ sucth that

$$\begin{align} a_i p_i + b_i r_i & \equiv n & \pmod{m_i}, \\ p_i + b_i + r_i & \equiv a_i & \pmod{m_i}. \end{align} \tag 1$$

The integral solutions to

$$ap + br = n, \\ p+ b + r = a \tag 2 $$

are finite and occur in the set of solutions of Eqn. (1). They are exactly the solutions

$$(p+b)(p+r) = n. \tag 3$$

Eqn. (3) follows from Eqn. (2).

Note: I am calling this a sum of rectangles decomposition of $n$ since $n = ap + br$ represents the sum of areas of two rectangles of sides $a\times p$ and $b \times r$.

Is there a way to limit the solutions of Eqn. (1) considering the fact that most of the solutions obtained through Chinese Remainder Theorem modulo $\prod_i m_i$ for Eqn. (1) that satisfy $(2)$ would eventually be discarded?

Another reason is we can filter many solutions by consisering the inequality

$$(p+b) \le \sqrt n \le (p+r)$$

These are the cofactors of $n$.

How can we make use of this in filtering solutions for Eqn. (1)?

The context is factoring $n$ from the residues in Eqn (1).

As an example:

Factors of $1387 (= 19 \times 73)$

basis: $m_i \in \{5, 7, 11\}$

The solution tuples are given as $(a_i,p_i,b_i,r_i,m_i)$.

Step 1: Solutions modulo $5$ : $16$ solutions

$$ (2, 5, 4, 3, 5), \\ (2, 5, 3, 4, 5), \\ (3, 5, 2, 1, 5), \\ (3, 5, 1, 2, 5), \\ (3, 4, 5, 4, 5), \\ (4, 4, 3, 2, 5), \\ (4, 4, 2, 3, 5), \\ (4, 3, 5, 1, 5), \\ (0, 3, 4, 3, 5), \\ (0, 3, 3, 4, 5), \\ (1, 2, 5, 4, 5), \\ (0, 2, 2, 1, 5), \\ (0, 2, 1, 2, 5), \\ (2, 1, 5, 1, 5), \\ (1, 1, 3, 2, 5), \\ (1, 1, 2, 3, 5) $$

Step 2: Solutions modulo $5 \times 7$ : $576$ solutions $$ (12, 0, 34, 13, 35), \\ (22, 0, 19, 3, 35), \\ (27, 0, 4, 23, 35), \\ (22, 0, 24, 33, 35), \\ (27, 0, 9, 18, 35), \\ (2, 0, 29, 8, 35), \\ (2, 20, 34, 18, 35), \\ (7, 20, 19, 3, 35), \\ (2, 20, 4, 13, 35), \\ (7, 20, 24, 33, 35), \\ (17, 20, 9, 23, 35), \\ (17, 5, 14, 33, 35), \\ (22, 5, 34, 18, 35), \\ (22, 5, 4, 13, 35), \\ (32, 5, 24, 3, 35), \\ \cdots, \\ (11, 16, 7, 23, 35), \\ (21, 16, 27, 13, 35), \\ (31, 16, 32, 18, 35), \\ (6, 16, 17, 8, 35), \\ (6, 16, 22, 3, 35), \\ (11, 1, 12, 33, 35), \\ (21, 1, 32, 23, 35), \\ (26, 1, 17, 8, 35), \\ (21, 1, 2, 18, 35), \\ (26, 1, 22, 3, 35) $$

Step 3: Solutions modulo $5 \times 7 \times 11 = 385$ : $57600$ solutions

$$ (152, 0, 384, 153, 385), \\ (47, 0, 174, 258, 385), \\ (257, 0, 349, 293, 385), \\ (257, 0, 139, 118, 385), \\ (327, 0, 314, 13, 385), \\ (47, 0, 104, 328, 385), \\ (117, 0, 279, 223, 385), \\ (117, 0, 69, 48, 385), \\ (327, 0, 244, 83, 385), \\ (222, 0, 34, 188, 385), \\ (257, 175, 384, 83, 385), \\ \cdots, \\ (376, 1, 162, 213, 385), \\ (201, 1, 337, 248, 385), \\ (201, 1, 127, 73, 385), \\ (271, 1, 302, 353, 385), \\ (376, 1, 92, 283, 385), \\ (61, 1, 267, 178, 385), \\ (61, 1, 57, 3, 385), \\ (271, 1, 232, 38, 385) $$

Finally, we find $24$ solutions that satisfy $a = p + b + r$:

$$ (87, 5, 14, 68, 385), \\ (77, 15, 4, 58, 385), \\ (82, 10, 63, 9, 385), \\ (77, 15, 58, 4, 385), \\ (78, 14, 5, 59, 385), \\ (73, 19, 0, 54, 385), \\ (88, 4, 15, 69, 385), \\ (83, 9, 10, 64, 385), \\ (79, 13, 60, 6, 385), \\ (74, 18, 55, 1, 385), \\ (89, 3, 70, 16, 385), \\ (80, 12, 7, 61, 385), \\ (90, 2, 17, 71, 385), \\ (85, 7, 66, 12, 385), \\ (75, 17, 56, 2, 385), \\ (90, 2, 71, 17, 385), \\ (86, 6, 13, 67, 385), \\ (81, 11, 8, 62, 385), \\ (76, 16, 3, 57, 385), \\ (91, 1, 18, 72, 385), \\ (86, 6, 67, 13, 385), \\ (81, 11, 62, 8, 385), \\ (76, 16, 57, 3, 385), \\ (91, 1, 72, 18, 385) $$

We see that $87 = 5 + 14 + 68$ and $(5+14)(5+68) = 19 \times 73$ which is the factorization.

The question is: there were only $24$ solutions that yield a nontrivial factorization of $n$. Is there a way to get to those without having to go through the $57600$ solutions modulo 385 (using CRT and filtering)?