
素数
coldfresh
那我们开始吧
展开
-
Squarefree number HDU - 3826(数论)
In mathematics, a squarefree number is one which is divisible by no perfect squares, except 1. For example, 10 is square-free but 18 is not, as it is divisible by 9 = 3^2. Now you need to determine whe原创 2017-09-25 13:10:43 · 602 阅读 · 0 评论 -
Prime Distance POJ - 2689 (素数)
The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of primalit原创 2017-09-27 14:46:31 · 341 阅读 · 0 评论 -
Sumdiv POJ - 1845(分治+素数筛+快速幂)
Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901). Input The only line contains the two natural n...原创 2018-03-18 22:51:39 · 220 阅读 · 0 评论 -
素数的线性欧拉筛
先上代码:#define maxx 400005using namespace std;int prime[100005];bool p[maxx];int cnt=0;void init(){ for(int i=2;i<maxx;i++) { if(!p[i]) prime[cnt++]=i; ...原创 2018-07-22 15:10:39 · 339 阅读 · 0 评论 -
今天让我们来学一学积性函数的筛法
第一件事情我们要知道的是:积性函数都可以线性筛。(就是说复杂度是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 · 493 阅读 · 0 评论