Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Here is the question:

The $x$, $y$, $x−y$ and $x+y$ are all positive prime integers. What is the sum of all the four integers?

Well, I just put some values and I got the answer. $x=5$, $y=2$, $x-y=3$, $x+y=7$. All the numbers are prime and the answer is $17$. Suppose if the numbers were very big, I wouldn't have got the answer. Do you know any ways to find the answer?

share|improve this question
I didn’t understand this question until I looked at the answers below. I thought the answer was “$3x+y$, obviously”. But now I see that you are looking for an actual number as an answer. The answers below show that there is only one set of values for $x$ and $y$ that makes the four integers positive and prime, so the actual work of the question is “what are the (only possible) values of $x$ and $y$?”. You’re saying you answered that question by brute-force guessing, but you want to know how to answer it with mathematical reasoning. –  Rory O'Kane Dec 4 '12 at 21:50
The answers below also prove that there is a unique solution, which your guess gives you no reason to believe. –  asmeurer Dec 4 '12 at 23:33
@RoryO'Kane Indeed, I had a hard time making sense of the question and answers until I realised the problem admitted only one solution which was implicitly required. –  Thomas Dec 5 '12 at 9:11

4 Answers 4

up vote 128 down vote accepted

Note that $x>y$, since $x-y$ is positive. Since $x$ and $y$ are both prime, this means that $x$ must be greater than $2$ and therefore odd. If $y$ were odd, $x+y$ would be an even number greater than $2$ and hence not prime. Thus, $y$ must be even, i.e., $y=2$.

Now we want an odd prime $x$ such that $x-2$ and $x+2$ are both prime. In other words, we want three consecutive odd numbers that are all prime. But one of $x-2,x$, and $x+2$ is divisible by $3$, so in order to be a prime it must be $3$. Clearly that one must be $x-2$, the smallest of the three numbers, and we have our unique solution: $x=5$ and $y=2$, and $x+y+(x+y)+(x-y)=3x+y=17$.

share|improve this answer
ALL THE 3 ARE CORRECT. Since I can only take 1 answer I took the best. –  chndn Dec 4 '12 at 9:21
@asmeurer: Of course; I really thought that the reason was sufficiently obvious not to require explanation. –  Brian M. Scott Dec 4 '12 at 23:32
Sure. It just sounds the way you've written it like you are saying it's $x - 2$ because that is the smallest. But I see now that you were just pointing out that that was the smallest, probably implicitly alluding to my argument above. –  asmeurer Dec 4 '12 at 23:35
@IanOverton: He's not saying $x$ is divisible by three, but that one of {$x-2$,$x$,$x+2$} is divisible by three. That one must be three (since it's prime), and it must be the smallest (since three is the smallest odd prime), i.e. $x-2 = 3$. –  hardmath Dec 5 '12 at 16:15
@Ian: As hardmath said, I’m not saying that $x$ is a multiple of $3$, just that one of the three numbers $x-2,x$, and $x+2$ has to be. You can verify this by brute force. If $x$ isn’t, then there is some integer $x$ such that $x=3n+1$ or $x=3n+2$. In the first case $x+2=3n+3$ is a multiple of $3$, and in the second case $x-2=3n$ is a multiple of $3$. Thus, in every case one of the three numbers is a multiple of $3$. Since these are primes, the one that’s a multiple of $3$ must be $3$. And since $3-2$ isn’t prime, $3$ must be the smallest of them, i.e., $x-2$. –  Brian M. Scott Dec 5 '12 at 21:23

Clearly $x>y$, since otherwise $x-y<0$ and therefore is not a prime.

Now since $x>y\ge2$, $x$ must be odd. Now $y$ must be even (i.e. 2) since if not $x+y$ is even and not prime.

The only set $\{x-2,x,x+2\}$ that consists of primes occurs when $x=5$. To see this, note that $\{x-2,x,x+2\}$ contains exactly $1$ number that is a multiple of $3$, so the multiple of $3$ in the set must be $3$ itself in order to be prime.

share|improve this answer
ALL THE 3 ARE CORRECT. Since I can only take 1 answer I took the best. –  chndn Dec 4 '12 at 9:21

Note that one of $x$ and $y$ has to be even, as if $x$ and $y$ are both odd, $x+y$ and $x-y$ are even, and there is only one even positive prime. As $x - y > 0$, we have $x > y$ and hence, as $2$ is the only even prime and the smallest prime, we have $y = 2$. No $x-2$, $x$ and $x+2$ are prime. But one of them is divisible by $3$: If $x$ has remainder 1 modulo 3, $x+2$ is divisible by 3, and if the remainder is 2, $x-2$ is. So, as $x-2$ is the smallest of the three numbers, we must have $x = 5$ (there is only one positive prime divisible by 3).

share|improve this answer
ALL THE 3 ARE CORRECT. Since I can only take 1 answer I took the best. –  chndn Dec 4 '12 at 9:20
As with the other answer, there is no reason a prori to conclude that the smallest of the numbers must be 3. You either have to note that $x - 2$ would be less than 2 if $x$ or $x + 2$ were 3, or else just test all three possibilities ($x - 2=3$, $x=3$, and $x+2=3$) and note that only one of them gives three primes for $x - 2$, $x$, and $x + 2$. –  asmeurer Dec 4 '12 at 23:32

Hint $\rm \ \ x,\,y,\,x\pm y\,$ pair-coprime $\rm \iff x,y$ coprime, opposite parity, $ $ i.e. $\,\rm(x,y)=1=(x\!-\!y,2)$

Proof $\rm\ \, (x,x\pm y) = (x,y) = (x\pm y,y)\:$ so it reduces to: $ $ $\rm(x\!-\!y,x\!+\!y)=1$ $\!\iff\!$ $\rm\: (x\!-\!y,2)=1,\:$ assuming $\rm\:(x,y)=1.\:$ Then $\rm\ (x\!-\!y,x\!+\!y)=(x\!-\!y,\color{#C00}2\color{#0A0}y)=(x\!-\!y,\color{#C00}2),\ $ by $\rm\:(x\!-\!y,\color{#0A0}y)=(x,y)=1.$

share|improve this answer
Thankyou for your answer. –  chndn May 29 '13 at 11:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.