26
2
Your challenge is to make a program or function that outputs the GCD of its inputs in one language and the LCM of its inputs in another. Builtins for GCD or LCM (I'm looking at you, Mathematica) are allowed but not encouraged. There will be 2 inputs, which will always be positive integers, never greater than 1000.
Test Cases
Each line is one test case in the format x y => GCD(x,y) LCM(x,y)
:
1 1 => 1 1
1 2 => 1 2
4 1 => 1 4
3 4 => 1 12
7 5 => 1 35
18 15 => 3 90
23 23 => 23 23
999 1000 => 1 999000
1000 999 => 1 999000
1000 1000 => 1000 1000
See this pastebin for all possible inputs with 0 < x, y < 31
. Note that different versions of the same languages count as different languages.
So... an
if
based on a version of the language, if stored in a variable, is allowed? – IllidanS4 wants Monica back – 2017-04-19T14:32:15.877@illidanS4 that is fine. – programmer5000 – 2017-04-19T17:04:37.403