kill(all)$

fpprintprec:10$
fpprec:10$

van=facebook.com/LearningCalculus$

gcd1(m,n):=gcd(m^3,n^2) = 2^2 * 3^2;

lcm1(m,n):=lcm(m^2,n^3) = 2^4 * 3^4 *5^6;

both(m,n):= gcd1(m,n) and lcm1(m,n);

K:3$

count:0$
for k:0 thru K do
    (for m:0 thru 10^k do
        for n:0 thru 10^k do
            if gcd1(m,n) then
                count: count + 1,
    print("Answer: GCD: ", count, " solutions out of ", (10^(2*k)),
          " pair examined, Or ", count/(10^(2*k))," = ", float(count/(10^(2*k)))))$

count:0$
for k:0 thru K do
    (for m:0 thru 10^k do
        for n:0 thru 10^k do
            if lcm1(m,n) then
                count: count + 1,
    print("Answer: LCM: ", count, " solutions out of ", (10^(2*k)),
          " pair examined, Or ", count/(10^(2*k))," = ", float(count/(10^(2*k)))))$