观察到 (10^{20}) 一定大于最小公倍数,如果按最小公倍数内的决策搞能拓展到 (infty)。
先除以最大公约数搞成互质,这一步对判断不影响。
不妨令 (p_1<p_2),现在一定存在某个 (d) 满足 (p_2|d imes p_1-1)。
这样相当于两个相同颜色中间拉满另一种颜色,是一定会取到的最坏的情况,判断即可。