![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线性筛
coldfresh
那我们开始吧
展开
-
今天让我们来学一学积性函数的筛法
第一件事情我们要知道的是:积性函数都可以线性筛。(就是说复杂度是O(n)O(n)O(n) 积性函数的性质不说了,在说说常见的几个积性函数。 μ(n)μ(n)\mu(n):莫比乌斯函数 ϕ(n)ϕ(n)\phi(n):欧拉函数 d(n)d(n)d(n):一个数n的约数个数 σ(n)σ(n)σ(n):一个数n的约数和那我们就来筛筛看吧,(注意:所有线性筛积性函数都必须基于线性筛素数。 ...原创 2018-07-22 18:24:11 · 441 阅读 · 0 评论 -
【CodeForces - 1154G】Minimum Possible LCM(涉及数论很多东西。。)
You are given an array a consisting of n integers a1,a2,…,an.Your problem is to find such pair of indices i,j (1≤i<j≤n) that lcm(ai,aj) is minimum possible.lcm(x,y) is the least common multiple o...原创 2019-05-09 19:20:00 · 338 阅读 · 0 评论