# Least common multiple and greatest common divisor problem.What instruction to use?

Here we have an equation in two variables that involves the greatest common divisor and the least common multiple, I can't think of what else to use.

$$Reduce[(LCM[x, y])^2 + (GCD[x, y])^ 2 == 900]$$ $$Solve[(LCM[x, y])^2 + (GCD[x, y])^ 2 == 900]$$ $$FindInstance[(LCM[x, y])^2 + (GCD[x, y])^ 2 == 900]$$

with no instructions I get something, any idea

FindInstance[LCM[x,y]^2+GCD[x,y]^2==900&&0<=x<=30,{x,y},Integers]


or

Reduce[LCM[x,y]^2+GCD[x,y]^2==900&&0<=x<=30&&0<=y<=30,{x,y},Integers]


or

Solve[LCM[x,y]^2+GCD[x,y]^2==900&&0<=x<=30&&0<=y<=30,{x,y},Integers]


or

Select[Tuples[{Range[0,30],Range[0,30]}],(LCM@@#)^2+(GCD@@#)^2==900&]

• Thanks, In the last example, could you explain to me how the symbols that appear there work, not the instructions, that is to say this @@ #) ^ 2+ (GCD @@ #) ^ 2 == 900 &] – zeros Aug 22 '20 at 20:24
• Certainly. Tuples is going to make a long list of lists of pairs like {{0,0},{0,1},{0,2}... Select is going to take each of those pairs, one at a time, and do a function to the pair to see whether the result is True or False. So the very first test will be on {0,0}. Now we want to perform LCM[0,0] but we have to do that given {0,0} which is the same as List[0,0]. So we need to turn List[0,0] into LCM[0,0] If you look up Apply in the help system it is used to change one function into another. @@ is the shorthand for Apply. # and & are shorthand for Function OK? – Bill Aug 22 '20 at 21:27
• A different way of writing that last one is f[{x_,y_}]:=(LCM[x,y])^2+(GCD[x,y])^2==900; Select[Tuples[{Range[0,30],Range[0,30]}],f] but that isn't the usual Mathematica "turn anything and everything you can into as few punctuation characters instead of spelled out function names as you possibly can" Does this help a little? – Bill Aug 22 '20 at 21:31
• @ Bill, Thank you very much for your time and explanation – zeros Aug 22 '20 at 23:03