[Math] Can any factor pairs (where pair is unique) have the same sum

factoring

I have used Stack Overflow but I'm new to this site so I apologize if this is a trivial question. I am creating mathematics software using javascript. I am using a for loop to find all factors for a given integer (n) as follows (simplified version):

n = someInteger;

for (i = 1; i <= n; i++) {
    if (n % i == 0) {
        var msg = 'The numbers ' + i + ' and ' + (n / i) + ' are factors of n';
        alert(msg);
    }
}

In brief, the loop cycles through all integers 1 to n and for each integer, calculates n mod i. If the modulus is 0, the pair i and n/i is a pair of factors for n. However, a la the commutative property, I don't want to "double count" pairs that have simply had their order switched. For example, in my method, if e.g. n = 10, 2 x 5 is a unique pair of factors but so is 5 x 2.

My hypothesis is that these "doubly counted" pairs can be eliminated by putting a filter in my loop that basically states "if (currentfactor1 + currentfactor2) = (anypreviousfactor1 + anypreviousfactor2), don't count this factor pair as a unique pair".

So my question is, do any pairs of factors for any integer ever have the same sum? My suspicion is no but I can't find proof of this. I took a couple of sample integers with several pairs of factors (two examples):

144 (1 x 144 (sum = 145), 2 x 72 (sum = 74), 3 x 48 (sum = 51), 4 x 36 (sum = 40), 6 x 24 (sum = 30), 8 x 18 (sum = 26), 9 x 16 (sum = 25), 12 x 12 (sum = 24) )

300 (1 x 300 (sum = 301), 2 x 150 (sum = 152), 3 x 100 (sum = 103), 4 x 75 (sum = 79), 5 x 60 (sum = 65), 6 x 50 (sum = 56), 10 x 30 (sum = 40), 12 x 25 (sum = 37), 15 x 20 (sum = 35) )

Can anyone please shed some light on this?
Thanks for any help

Best Answer

Let $n$ be positive. Then for positive real $x$, the function $x+\frac{n}{x}$ decreases until $x=\sqrt{n}$ and then increases. So for any $k$ there are at most two real positive values of $x$ such that $x+\frac{n}{x}=k$.

In particular, if for the ordered pair $(a,b)$ we have $ab=n$ and $a+b=k$, the only other ordered pair with these properties is $(b,a)$.

Related Question