先将问题差分,即仅考虑上限$R$(和$L-1$) 注意到$f(x,y)$增长是较快的,对其分类讨论: 1.若$y\ge x+2$,此时满足$f(x,y)\le 10^{18}$的$(x,y)$只有约$10^{6}$组,暴力预处理并通过二分+前缀和即可 2.若$y=x+1$,显然$f(x,y)=x(x+1)$且$\varphi(f(x,y))=\varphi(x)\varphi(x+1)$ 换言之,问题即求$\sum_{x\ge 1,x(x+1)\le R}\varphi(x)\varphi(x+…