# Math Olympiad Prime Number Question

If $p$, $q$ and $r$ are prime numbers such that their product is $19$ times their sum, find $p^2$ + $q^2$ + $r^2$.

I came across this question in a Math Olympiad Competition and had no idea how to do it. Can anyone help?

-
Can you tell which Math Olympiad Competition is this. You have posted some very good questions and all of them according to you are from this Math Olympiad. –  Samurai Jun 5 at 10:03
This Math Olympiad is SMO(Junior) 2014 –  snivysteel Jun 5 at 10:04

One of the primes must be $19$, so WLOG $r=19$. Then $(p-1)(q-1)=20$. There aren't too many ways to factorise $20$...

-
Just out of curiosity, can you explain why one of the primes must be 19? –  thanby Jun 5 at 14:14
@thanby As p, q, r are prime numbers, their product will only have p, q, r and 1 as divisors. Hence, one of them must be 19. –  fedorqui Jun 5 at 14:16
How did you know $(p-1)(q-1)=20$? –  Cruncher Jun 5 at 14:56
because pq - p - q = 19 & (p-1)(q-1) = pq - p - q + 1 –  MD-Tech Jun 5 at 14:58
@fedorqui You forgot $pq, qr, rp, pqr$. Probably you mean to say that $p, q, r$ are the only prime divisors. –  Goos Jun 5 at 22:56

Expanding on Ivan Loh's answer:

If $p$, $q$ and $r$ are prime numbers such that their product is $19$ times their sum, find $p^2$ + $q^2$ + $r^2$.

This expression can be written as: $pqr=19(p+q+r)$

As p, q, r are prime numbers, its product will just have p, q and r as prime divisors. Hence, one of them must be 19. Say $r=19$. Then, we have:

$pq19 = 19(p+q+19)$

$pq = p+q+19$

$pq-p-q = 19$ (*)

On the other hand, we always have the expression: $(p-1)(q-1) = pq-p-q+1$

which is equivalent to:

$(p-1)(q-1)-1 = pq-p-q$

Joining with (*)

$(p-1)(q-1)-1 = 19$

$(p-1)(q-1) = 20$

20 can be factorised in: $20=2*2*5$

in blocks of two:

$20=4 * 5$

or

$20=2 * 10$

or

$20=1 * 20$

so we have to options:

### First

$p-1=4 -> p=5$

$q-1=5 -> q=6$

This cannot happen, because $p$, $q$, $r$ have to be prime and $p=6$ is not.

### Second

$p-1=1 -> p=2$

$q-1=20 -> q=21$

This cannot happen, because $p$, $q$, $r$ have to be prime and $q=21$ is not.

### Third

$p-1=2 -> p=3$

$q-1=10 -> q=11$

Both $p=3$ and $q=11$ are prime numbers, so we can go ahead. In such case,

$p^2 + q^2 + r^2 = 3^2 + 11^2 + 19^2 = 9 + 121 + 361 = 491$

-
Note the First case is false because it asserts q = 6 which is false due to the fact that q is prime. Therefore we only have the second case –  Geoff Naylor Jun 6 at 23:57
@GeoffNaylor fair enough. Updated accordingly. –  fedorqui Jun 10 at 8:29
There are other factorisations of 20 which need to be taken into account: 1*20, -1 * -20, etc. Obviously they don't result in solutions, but they should be acknowledged. –  Tibos Jun 10 at 11:11