About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
September 2024 - Solution
September 2024 Solution:
A solution to the main problem is
A solution to the bonus is
The area of a triangle with sides a,b,c is given by **Heron's formula**: denote , and the area
is
. Thus, if we want to find
such that the area of the triangles
and
is equal, it sufficies to satisfy the equation
. Assuming
this simplifies to
, which is related to a classical problem in number theory - the representation of an integer N as the sum of two squares.
Given N, finding such representation can be hard unless one has the factorization of N, and then one case use a recursive algorithm for finding all such representations thanks to the Brahmagupta–Fibonacci identity
Which shows how to obtain a representation as sums of squares of a number from such representations of
.
We are looking for solutions to to the equation where
. However, not every
which satisfy the equation lead to a triangle, since the area might turn out to be zero or negative: we need to have
, assuming
. We proceed as follows, given some
." alt="a-b
. We proceed as follows, given some
.
- Compute the list of all
such that
- Compute the list of all
such that
- Check whether there are
such that exactly 50 pairs
satisfy
(for the bonus: also check whether we have at least two integer areas).
To solve the problem, one iterates on various values of . It is best to look at the first few primes congruent to 1 modulo 4, since product of such primes is guaranteed to be representable as sum of squares. The relatively small solution
can be found using
(where 5,13,17 are the first primes congruent to 1 modulo 4). The even smaller solution
is obtained by considering two more primes:
.
Finding solution to the basic problem is extremely quick given efficient implementations for steps 1-3, but finding a solution to the bonus can still be difficult.