Find pairs of numbers with a particular LCM and GCD I was working on a math question with a friend of mine, and we decided to write a script that finds the answer. The original question is as follows:


  The difference of two natural numbers is 2010 and their greatest common denominator is 2014 times smaller than their lowest common multiply. Find all the possible solutions.


We started writing the program independently of each other, and when it worked we decided to golf it up to get the least amount of bytes we could manage. We ended up with this beautiful line of code at a marvelous 89 bytes.

from fractions import*;print[i for i in range(10**6)if i*(i+2010)/gcd(i,i+2010)**2==2014]


We wanted to see if anyone manages to write a shorter piece of code, that enumerates the first 1 million i's. If you are brave enough to compete, you may use any language you like, but we would prefer Python 2 to be able to compare your code with ours.

Usual rules apply, shortest bytes win.
The standard code golf loopholes apply. Standard &quot;loopholes&quot; which are no longer funny

Have fun!
Mathematica, 8 bytes

{4,5092}


Proof that 4 and 5092 are the only solutions: The original problem can be rewritten as 


  x (x + 2010) = 2014 GCD(x, x+2010)2


Let's write x as 2a2 3a3 5a5… and x + 2010 as 2b2 3b3 5b5… Then the equation becomes


  2a2+b2 3a3+b3 5a5+b5… = 2014 22min(a2,b2) 32min(a3,b3) 52min(a5,b5)…


Since 2014 = 2 × 19 × 53, we have


  ap + bp = 2min(ap, bp) + { 1 if p &isin; {2, 19, 53}, 0 else }


Thus


  ap = bp if p ≠ 2, 19, 53
  ap = bp±1 else


Thus


  x + 2010 = 2±1 19±1 53±1 x


There are only 8 possible choices, and we could easily check that 4 and 5092 are the only positive integer solutions. 

Wait, I hear people screaming standard loophole…

Mathematica, 45 bytes

Select[Range[9^7],2014GCD[#,s=#+2010]^2==s#&amp;]