转自:http://www.cnblogs.com/linyujun/p/5198832.html

整合:https://blog.csdn.net/x_i_y_u_e/article/details/46365549

整合:https://blog.csdn.net/qq_43332305/article/details/82959066

  1. π(x) ,素数分布函数,为小于等于 x 的素数的个数。
  2. 当 x 趋于 无穷大时,π(x) 与 x / lnx等价。
  3. 当 x 趋于 无穷大时,1~x 中所有素数的倒数和与 $\ln \ln x$ 等价。
  4. factor(x) 表示x的因子个数,比如 factor(6) = 4。

素数

定义

除了1和它本身以外不再有其他的因数的数。也叫质数。

素数判定

根据素数的定义判定(复杂度$O(\sqrt{n})$)

代码如下

1 //素数
2 inline bool isPrime(const LL x) {
3     if (x <= 1)return false;
4     for (LL i = 2; i * i <= x; i++)if (x % i == 0)return false;
5     return true;
6 }
View Code

相关文章:

  • 2022-12-23
  • 2021-08-31
  • 2021-05-08
  • 2021-09-28
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-10
  • 2022-12-23
  • 2021-10-26
  • 2021-06-14
  • 2022-02-13
  • 2022-02-25
  • 2022-02-06
相关资源
相似解决方案