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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

All numbers are assumed nonzero natural numbers. All numbers are assumed unequal.

Suppose we have $ab = xy$, and $a+b = cd$.

$x$ is set to be fixed from beginning, and it is assumed that one knows the prime factorization of it. $d$ is not fixed, and $d$ is a factor of $x$.

What I want to know is how one finds/sets the values of $a,b,c,d,y$ that satisfies the constraint with the given $x$.

Edit: I edited the question so that $d$ is now a factor of $x$.

Without brute-forcing, what would be an easy way to find a possible way of setting values?

share|cite|improve this question
up vote 2 down vote accepted

The complete solution space consists of all possible results that can be obtained by the following procedure, then rejecting any solutions that have a repeated value:

  • Choose any value for $y$
  • Obtain the prime factorization of $xy$
  • Choose $a$ and $b$ by distributing the primes in $xy$ between them
  • Obtain the prime factorization of $a+b$
  • Choose $c$ and $d$ by distributing the primes in $a+b$ between them

For example, if $x$ is $6$, then one solution obtained by this procedure is

  • Let $y = 10$
  • $xy = 2 \cdot 2 \cdot 3 \cdot 5 $
  • Let $a = 2 \cdot 2 \cdot 5$ and $b = 3$
  • $a+b = 23$
  • Let $c = 1$ and $d = 23$

For the revised problem, the following procedure works for all solutions.

  • Choose any value for $d$ dividing $x$
  • Choose any factorization $x = uv$
  • Obtain the complete solution space $(s,t)$ for the equation $$ us + vt \equiv 0 \pmod d $$
  • Choose any positive values for $s,t$
  • Let $a = us$
  • Let $b = vt$
  • Let $c = (a+b) / d $
  • Let $y = st$

(Note this procedure is redundant: I believe the same solution can be obtained in multiple ways)

share|cite|improve this answer
I apologize.. I just edited the question. Would you like to have a look at it? Thanks. – La Ventana Nov 3 '12 at 10:02
Thank you very much! – La Ventana Nov 3 '12 at 11:32

You ask for one possible way of setting values. Here's one: $$a=b=y=d=x,\quad c=2$$

share|cite|improve this answer
So the easy way of finding the possible way of setting values is reading your answer? ;) – tomasz Nov 3 '12 at 12:03
@tomasz, the wording of the problem was altered after I posted my answer. – Gerry Myerson Nov 3 '12 at 22: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.