给定 [ a , b ] [a,b] [a,b] ,求 lcm ( i , j ) \text{lcm}(i,j) lcm(i,j) 在 [ a , b ] [a,b] [a,b] 中的有序点对 ( i , j ) (i,j) (i,j) 的数量。
a , b ≤ 1 0 11 a,b\leq 10^{11} a,b≤1011 。
sol :
考察 lcm ( i , j ) = n \text{lcm}(i,j)=n lcm(i,j)=n 时无序点对 ( i , j ) (i,j) (i,j) 的数量。
233
∑ i ∣ n ∑ j ∣ n [ i j ( i , j ) = n ] = ∑ k ∣ n ∑ i ∣ n k ∑ j ∣ n k [ ( i , j ) = 1 , i j = n k ] = ∑ k ∣ n ∑ i ∣ n k [ ( i , n i k ) = 1 ] = ∑ k ∣ n ∑ i ∣ n k ∑ j ∣ ( i , n i k ) μ ( j ) = ∑ j ∣ n μ ( j ) ∑ j ∣ i , i ∣ n j ∑ k ∣ n i j 1 = ∑ j 2 ∣ n μ ( j ) ∑ i ∣ n j 2 ∑ k ∣ n i j 2 1 = ∑ j 2 ∣ n μ ( j ) ∑ i ∣ n j 2 d ( n i j 2 ) \sum_{i|n}\sum_{j|n}[\frac{ij}{(i,j)}=n] \\ =\sum_{k|n}\sum_{i|\frac{n}{k}}\sum_{j|\frac{n}{k}}[(i,j)=1,ij=\frac{n}{k}] \\ =\sum_{k|n}\sum_{i|\frac{n}{k}}[(i,\frac{n}{ik})=1] \\ =\sum_{k|n}\sum_{i|\frac{n}{k}}\sum_{j|(i,\frac{n}{ik})}\mu(j) \\ =\sum_{j|n}\mu(j)\sum_{j|i,i|\frac{n}{j}}\sum_{k|\frac{n}{ij}}1 \\ =\sum_{j^2|n}\mu(j)\sum_{i|\frac{n}{j^2}}\sum_{k|\frac{n}{ij^2}}1 \\ =\sum_{j^2|n}\mu(j)\sum_{i|\frac{n}{j^2}}d(\frac{n}{ij^2}) i∣n∑j∣n∑[(i,j)ij=n]=k∣n∑i∣kn∑j∣kn∑[(i,j)=1,ij=kn]=k∣n∑i∣kn∑[(i,ikn)=1]=k∣n∑i∣kn∑j∣(i,ikn)∑μ(j)=j∣n∑μ(j)j∣i,i∣jn∑k∣ijn∑1=j2∣n∑μ(j)i∣j2n∑k∣ij2n∑1=j2∣n∑μ(j)i∣j2n∑d(ij2n)
∑ k = 1 n ∑ j 2 ∣ k μ ( j ) ∑ i ∣ k j 2 d ( k i j 2 ) = ∑ j 2 ≤ n μ ( j ) ∑ k = 1 [ n j 2 ] ∑ i ∣ k d ( i ) = ∑ j 2 ≤ n μ ( j ) ∑ k = 1 [ n j 2 ] d ( k ) [ n j 2 k ] \sum_{k=1}^n\sum_{j^2|k}\mu(j)\sum_{i|\frac{k}{j^2}}d(\frac{k}{ij^2}) \\ =\sum_{j^2\leq n}\mu(j)\sum_{k=1}^{[\frac{n}{j^2}]}\sum_{i|k}d(i) \\ =\sum_{j^2\leq n}\mu(j)\sum_{k=1}^{[\frac{n}{j^2}]}d(k)[\frac{n}{j^2k}] \\ k=1∑nj2∣k∑μ(j)i∣j2k∑d(ij2k)=j2≤n∑μ(j)k=1∑[j2n]i∣k∑d(i)=j2≤n∑μ(j)k=1∑[j2n]d(k)[j2kn]
事后来看,其实当时我做这道题的时候并没有抓住它的本质。
好在我们展开一下。
F ( n ) = ∑ i = 1 n d ( i ) [ n i ] = ∑ a ∑ b ∑ c [ a b c ≤ n ] F(n)=\sum_{i=1}^nd(i)[\frac{n}{i}] \\ =\sum_a\sum_{b}\sum_{c}[abc\leq n] F(n)=i=1∑nd(i)[in]=a∑b∑c∑[abc≤n]
于是可以转化为经典的三元计数问题。
∑ j 2 ≤ n μ ( j ) F ( [ n j 2 ] ) \sum_{j^2\leq n}\mu(j)F([\frac{n}{j^2}]) j2≤n∑μ(j)F([j2n])