Suppose $P$ and $Q$ are both prime numbers $$5P+7Q= 109$$ Find the value of $P$.

I thought about examining all terms for parity, and I approached it by this:

Suppose $5P$ was an even number. However, the only even prime number is $2$, so that would make $5P$ = $10$ and $7Q =99$. However, since $7$ doesn't divide fully into $99$, this means that $7Q$ must be even. But how do I approach it from there?

P.S. I'm only an Year 7 and this is Year 9 work. Please explain clearly how you found the solution.

  • 3
    $\begingroup$ Why not try with $Q=2?$ $\endgroup$ Mar 21, 2017 at 11:09
  • 1
    $\begingroup$ Good approach by the way. Just have to be thorough in checking your cases. $\endgroup$
    – lulu
    Mar 21, 2017 at 11:19
  • $\begingroup$ using familiar rules for adding odd and even numbers, 5P + 5Q + 2Q = 109 so 5(P + Q) + 2Q = 109 2Q is even, so 5(P + Q) must be odd and P + Q must be odd, so therefore P & Q cannot both be odd primes, one of them is even, one of them must be 2 $\endgroup$
    – Cato
    Mar 21, 2017 at 11:27

4 Answers 4


You have already deduced that one of $(P,Q)$ must be $2$.

Also, you’ve tried putting $P=2$ and correctly found that did not give a solution.

The only other option is $Q=2$, so $7Q=14$ and the equation becomes, $$5P+14=109$$ $$5P=95$$ $$P=19$$


Observe that we can express $5P+7Q=109$ as $P=\frac{109-7Q}{5}$ then this means that:

$109 - 7Q \equiv 0 \pmod 5$ thus $109 \equiv 7Q \pmod 5$ and reducing it $4 \equiv 2Q \pmod 5$

Then we reach the congruence relation $Q \equiv 2 \pmod 5$.

Since $Q\in \mathbb{P}$ (prime) and $109-7Q$ has to be positive, therefore enumerate primes that make this equivalence positive, these are: $\{2,7\}$

For $Q=7$ note that $P=\frac{109 - 49}{5} = 12$ (even) then $P\not \in \mathbb{P}$ (not prime).

For $Q=2 \Rightarrow P=\frac{109 - 14}{5} = 19$ (odd) and $P \in \mathbb{P}$ (prime)

Thus the solution is $P=19,Q=2$

  • $\begingroup$ we haven't learn't about mods or the 3-dash sign yet $\endgroup$
    – bio
    Mar 22, 2017 at 7:57

If you observe carefully, unit digit of 5P will always be either 0 or 5. It will be 0 when P is even and 5 when P is odd. A number cannot be prime if it is even (except 2). So let us assume that unit digit of 5P is 5. (If we dont find the answer, we will try taking P=2).

Now, unit digit of 7Q has to be 4. This is because

5 + 4 = 9.

9 is unit digit of 109.

Try Q as prime to make unit digit of 7Q as 4.

First try: Q=2

7*2 = 14 Then 5P = 109 - 14 = 95 this makes P = 19 which is again prime.

So P = 19 and Q = 2.

Hope I was able to explain comprehensibly.



Since (-2) is not a prime number, the problem should be:

Suppose $P$ and $Q$ are both prime numbers

$$5P= 109-7Q$$

Find the value of $P$

The answer: $P=2$

  • 2
    $\begingroup$ As I showed, P can't be 2 because 109-10=99 and 7 doesn't go into 99 and the digits need to be whole $\endgroup$
    – bio
    Mar 21, 2017 at 12:01
  • $\begingroup$ do you mean Q=2 $\endgroup$
    – bio
    Mar 21, 2017 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .