gpf(n) = if (n==1, 1, my (p=factor(n)[, 1]~); p[#p]) T(n, k) = if (n==1 || k==1, max(n, k), my (p=gpf(n), q=gpf(k)); max(p, q)*T(n/p, k/q)) for (n=1, 10 000, print (n " " v=if (n==1, 1, T(v, n)))) quit