Solving $a + b + c = 57, a^2 + b^2 - c^2 = z, zc = 2017$ in integers

88 Views Asked by At

So, this was the task in a competition. We had no calculators or formula books or anything. Just pen and paper.

I think I solved it, but damn, there has to be an easier route. I simply can't imagine they would put a task in there like... this!

So the task was:

For which real numbers $z$ exist positive whole numbers $a$, $b$ and $c$ which fulfill the following set of equations

$$a + b + c = 57$$

$$a^2 + b^2 - c^2 = z$$

$$z \cdot c = 2017$$

Find all solutions ($a$, $b$, $c$) depending on $z$.

My try:

From the second equation we can clearly see that $z$ must be a whole number.

The we can derive from equation three that

$$z = 2017/c$$

So, since $z$ is a whole number, we can see that $2017/c$ must be a whole number as well. So $c$ must be a divisor of 2017.

Well, and now starts the fun part...

We need to get all divisors of 2017. This is a problem I could solve in three minutes with a pc or calculator. But those weren't allowed.

So I needed to test for all prime numbers up to $45$ (roughly $\sqrt{2017}$) if they'd divide 2017.

And guess what... Not a single one did. So 2017 is a prime.

That leaves only $c = 1$ or $c = 2017$ as possibilities. We can ignore the latter case because then equation one would not be true anymore.

With $c = 1$ that leaves us with two equations we can derive:

$$a + b = 56$$

$$a^2 + b^2 = 2018$$

Substitute one into the other...

$$a^2 + (56 - a)^2 = 2018$$

Using the known formula after some simplifying gives

$$a_1 = 28 + \sqrt{1343}$$

$$a_2 = 28 - \sqrt{1343}$$

None of these are whole numbers, so there is no solution.

But I was doing division for ninety minutes straight, just to find out that 2017 is indeed prime! The hell? That was no fun at all.

So, my instinct is telling me there must be a better solution.

Can you help me?

2

There are 2 best solutions below

0
On

As you mentioned, $c = 1$ and $z = 2017$

This leads to the equations $a^2 + b^2 = 2018$ and $a + b = 56$ as you found.

You could solve the quadratic equation as you tried (although you made a mistake, it should be $a = 28 \pm \sqrt{225} = 28 \pm 15$), but here is a possible other way:

But instead of solving the quadratic, you can try the squares under 56 and see if they can add to 2018.

The function $a^2 + (56 - a)^2$ is a quadratic with a minimum value at $28$. To the left and right of $28$, the quadratic is increasing, so we can use binary search (e.g. if $a > 28$ and $a^2 + (56 - a)^2 > 2018$, then we know we need to try a smaller a)

So for example you could start with $a = 44$ and find $44^2 + (56 - 44)^2 = 2080 > 2018$ so next we could try $a = 43$ which is one of the solutions.

1
On

"So I needed to test for all prime numbers up to 45 (roughly 2017−−−−√) if they'd divide 2017"

Annoyingly that is not considered unreasonable task to be asked. Clearly, $2,3,5,7,11$ can be ruled out in seconds.

That leaves $13,17,19,23,29,31,37,41,43$

Just "cast out". $13: 13|2017\iff 13|704\iff 13|691\iff 13|301\iff 13|41$

$17|2017 \iff 17|200$

$19|2017 \iff 19|117\iff 19|98$

$23|2017 \iff 23|2300-2017\iff 23|283\iff 23|260\iff 23|26$

$29|2017 \iff 29|2307\iff 23|2887$

$31|2017 \iff 31|2017 + 93=2110\iff 31|211\iff 31|311-100\iff 31|99$

$37|2017 \iff 37|1980\iff 37|198;3*37=90+21=111;37|198\iff 37|87$

$41|2017 \iff 41|2050-2017=33$

$43|2017 \iff 43|2150-2017=133\iff $43|90$.

That should take 10 tedious minutes tops.

Then $z = a^2 + b^2 - c = z$ so $z\in \mathbb Z$ and $0 < c < 57$ so $c = 1$ and $z =2017$

So $a + b = 56$ and $a^2 + b^2 = 2018$. $2018$ is not divisible be $4$ so $a,b$ are both odd.

Let $a = 2k + 1$ and $b = 2m + 1$ and $k + m = 27$ and $4(k^2 + k + m^2 +m)= 2016$ so $k^2 + m^2 + 27=504$ so $k^2 + m^2 = 477$

If $k=20; m = 7$ then $k^2 + m^2 = 449$. So $k > 20$ and $m < 7$.

$k=21;m=6\implies k^2 + m^2 = 441+36 = 477$.

So let's check. $a = 43; b=13; c= 1$ and $a+b+c=57$ and $43^2 + 13^2 -c= 1600+ 240 + 9 + 169 -1 = 2017$.