码迷,mamicode.com
首页 >  
搜索关键字:calculate prime s    ( 3428个结果
初探莫比乌斯反演
我们首先从这个函数出发:$\mu(n)$,它被称作莫比乌斯函数 它的定义式是这样的 $$ \mu(n)= \begin{cases} 1& n=1\\ ( 1)^r& n=p_1p_2\ldots p_r,p_1,p_2,\ldots p_r\in prime\\ 0& p^k|n,p\in pri ...
分类:其他好文   时间:2018-12-01 00:04:14    阅读次数:189
Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers http://poj.org/problem?id=2739 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 28929 Accepted: 15525 Descr ...
分类:其他好文   时间:2018-11-29 23:14:14    阅读次数:177
比n大的最小不重复数
1 void Calculate(int a) 2 { 3 int pa = a; 4 int count = 0; 5 int b[20] = {0}; 6 7 //将pa按位存储到数组b 8 while(pa > 0) 9 { 10 b[count++] = pa%10; 11 pa = pa/... ...
分类:其他好文   时间:2018-11-24 20:59:33    阅读次数:219
Codeforces 450B Jzzhu and Sequences
Jzzhu and Sequences Jzzhu has invented a kind of sequences, they meet the following property: You are given x and y, please calculate fn modulo 100000 ...
分类:其他好文   时间:2018-11-22 22:28:03    阅读次数:162
UVA10140 Prime Distance
题意翻译 大致意思:给定两个整数L,R(1<=L<=R<=2147483648,R-L<=1000000),求闭区间 [L,R]中相邻两个质数的差的最小值和最大值是多少,分别输出这两个质数。 【输入格式】 输入有若干行,每行两个整数 L,R 【输出格式】 对于每个L,R输出最小值和最大值,格式参照样 ...
分类:其他好文   时间:2018-11-21 10:21:24    阅读次数:109
莫比乌斯反演简略版
$g(x)=\sum\limits_{d|x}f(d) \iff f(x)=\sum\limits_{d|x}\mu(\frac{x}{d}) g(d)$ $g(x)=\sum\limits_{x|d}^nf(d) \iff f(x)=\sum\limits_{x|d}^n\mu(\frac{d}{ ...
分类:其他好文   时间:2018-11-20 23:06:18    阅读次数:204
素数打表——找出1~100以内的素数
素数筛选法: include using namespace std; //素数打表模板 bool is_prime[100]; int main() { for(int i = 2;i ...
分类:其他好文   时间:2018-11-19 22:38:16    阅读次数:170
判断素数
#include #include int main() { int n,i,k; int isprime=1; scanf("%d",&n); k=sqrt(n);//n的每一对因子必有一个大于根号n,一个大于根号n for(i=2;i<=k;i++) { if(n%i==0) { is... ...
分类:其他好文   时间:2018-11-19 22:10:53    阅读次数:230
bzoj 2820 luogu 2257 yy的gcd (莫比乌斯反演)
题目大意:求$gcd(i,j)==k,i\in[1,n],j\in[1,m] ,k\in prime,n,m<=10^{7}$的有序数对个数,不超过10^{4}次询问 莫比乌斯反演入门题 为方便表述,由于n和m等价,以下内容均默认n<=m 题目让我们求:$\sum_{k=1}^{n}\sum_{i= ...
分类:其他好文   时间:2018-11-16 17:46:20    阅读次数:183
#Leetcode# 204. Count Primes
https://leetcode.com/problems/count-primes/ Count the number of prime numbers less than a non-negative number, n. Example: 代码: ...
分类:其他好文   时间:2018-11-15 14:33:13    阅读次数:194
3428条   上一页 1 ... 54 55 56 57 58 ... 343 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!