(a,b)×[a,b]=a×b(a,b)\times[a,b]=a\times b

证明:

a=i=1kpiαi,b=i=1kpiβia=\prod\limits_{i=1}^{k}p_i^{\alpha_i},b=\prod\limits_{i=1}^{k}p_i^{\beta_i}

则有:

(a,b)×[a,b]=(i=1kpimin(αi,βi))×(i=1kpimax(αi,βi))=i=1kpimin(αi,βi)+max(αi,βi)=i=1kpi(αi+βi)=a×b\begin{aligned}(a,b)\times[a,b]&=\left(\prod_{i=1}^{k}p_i^{\min\left(\alpha_i,\beta_i\right)}\right)\times\left(\prod_{i=1}^{k}p_i^{\max\left(\alpha_i,\beta_i\right)}\right)\\&=\prod_{i=1}^{k}p_i^{\min\left(\alpha_i,\beta_i\right)+\max\left(\alpha_i,\beta_i\right)}\\&=\prod_{i=1}^{k}p_i^{\left(\alpha_i+\beta_i\right)}\\&=a\times b\end{aligned}

注意开 __int128 即可。

#include<cstdio>
#define int __int128
int init(){
	char c = getchar();
	int x = 0, f = 1;
	for (; c < '0' || c > '9'; c = getchar())
		if (c == '-') f = -1;
	for (; c >= '0' && c <= '9'; c = getchar())
		x = (x << 1) + (x << 3) + (c ^ 48);
	return x * f;
}
void print(int x){
	if (x < 0) x = -x, putchar('-');
	if (x > 9) print(x / 10);
	putchar(x % 10 + '0');
}
int gcd(int a, int b){
    return b ? gcd(b, a % b) : a;
}
signed main(){
	int a = init(), b = init();
    print(a / gcd(a, b) * b), putchar('\n');
}