## Given positive integers $a \le b \le c \le d$, it may be possible to form quadrilaterals with edge lengths $a,b,c,d$ (in any order). When this is the case, let $M(a,b,c,d)$ denote the maximal area of such a quadrilateral. For example, $M(2,2,3,3)=6$, attained e.g. by a $2\times 3$ rectangle.

Let $SP(n)$ be the sum of $a+b+c+d$ over all choices $a \le b \le c \le d$ for which $M(a,b,c,d)$ is a positive integer not exceeding $n$.

$SP(10)=186$ and $SP(100)=23238$.

Find $SP(1\,000\,000)$.

### The problem here involves understanding the maximum area of a quadrilateral given its four side lengths. There’s a principle in mathematics calls Brennan’s Lemma that tells us when it’s possible and how to compute it.

According to the lemma, a condition for forming a quadrilateral with edge lengths `a, b, c, d` (in any order) is that the sum of the smallest three side lengths should be greater than the largest side length.

Then, in such case, the maximal area of such a quadrilateral could be calculated with Brahmagupta’s Formula:

“`

Area = sqrt((s-a)*(s-b)*(s-c)*(s-d))

“`

where `s` is the semi-perimeter of the quadrilateral which is `(a+b+c+d)/2`.

We need to find all four sides `a,b,c,d` such that `Area` is an integer, sum them up and return the sum over all choices.

Now, this task involves a large computational problem. It would require an appropriate algorithm and then it should be run on a computer to get the result of `SP(1_000_000)`.

The whole problem falls under the category of combinatoric geometric problem. You would apply the mathematical principles, described, to build a program to iterate over possible quadrilateral dimensions, and for each, computing and verifying the area, then summing per the requirements.

##### More Answers:

Fermat-like EquationsFreefarea

Yarra Gnisrever