The greatest common divisor of two integers is (x+4) and their least common multiple is x(x+4), where x is a positive integer. If one of the integers is 24, what is the smallest possible value of the other one?
a=1; b=1; if(gcd(24 , b)==(a + 4) and lcm(24,b)==a*(a+4), goto loop, goto next);loop:printa, b;print gcd(24, b);print lcm(24,b);next: a++;if(a<1000, goto2, 0);a=1;b++;if(b<1000, goto2, discard=0;
OUTPUT:
x = 20 and GCD =20 +4 =24 and LCM =20*(20 + 4) = 480
The smallest possible value of 2nd number = 480, so that:
GCD[24, 480] == 24 and LCM[24, 480] ==480, which agrees with the value of x ==20.