f(n) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 457    Accepted Submission(s): 279 Problem Description This time I need you to calculate the f(n) . (3<=n<=1000000) f(n)= Gcd(3)+Gcd(4)+…+Gc…
I won't tell you this is about number theory Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 458    Accepted Submission(s): 142 Problem Description To think of a beautiful problem description is…
Problem Description Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, etc. Specially, LPF(1) = 0. Inpu…
Largest prime factor Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9993    Accepted Submission(s): 3528 Problem Description Everybody knows any number can be combined by the prime number.Now,…
题目链接:传送门 题目: Prime Distance Time Limit: 1000MS Memory Limit: 65536K Total Submissions: Accepted: Description The branch of mathematics called number theory and itself). The first prime numbers are ,,, but they quickly become less frequent. One of the…
题意:输入一个数判断是不是素数,并规定2不是素数. 析:一看就很简单吧,用素数筛选法,注意的是结束条件是n<0,一开始被坑了... 不说了,直接上代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; typedef long long LL; const int maxn = 16000 + 10; int p…
喵喵的神∙数 Time Limit: 1 Sec Memory Limit: 128 MB Description 喵喵对组合数比較感兴趣,而且对计算组合数很在行. 同一时候为了追求有后宫的素养的生活,喵喵每天都要研究 质数. 我们先来复习一下什么叫做组合数.对于正整数P.T                                                           然后我们再来复习一下什么叫质数.质数就是素数,假设说正整数N的约数仅仅有1和它本身,N就是质数:另外. 1…
对于数论的学习比较的碎片化,所以开了一篇随笔来记录一下学习中遇到的一些坑,主要通过题目来讲解 本题围绕:素数筛选法与空间换时间 HDU4548美素数 题目描述 小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识.问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“美素数”,如29,本身是素数,而且2+9 = 11也是素数,所以它是美素数.给定一个区间,你能计算出这个区间内有多少个美素数吗? 输入 第一行输入一个正整数T,表示总共…
ACM数论之旅5---数论四大定理(你怕不怕(☆゚∀゚)老实告诉我)   (本篇无证明,想要证明的去找度娘)o(*≧▽≦)ツ ----------数论四大定理--------- 数论四大定理: 1.威尔逊定理 2.欧拉定理 3.孙子定理(中国剩余定理) 4.费马小定理 (提示:以后出现(mod p)就表示这个公式是在求余p的条件下成立) 1.威尔逊定理:(PS:威尔逊是个厉害人) 当且仅当p为素数时:( p -1 )! ≡ -1 ( mod p ) 或者这么写( p -1 )! ≡ p-1 (…
http://lightoj.com/volume_showproblem.php?problem=1236 Pairs Forming LCM Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1236 Description Find the result of the following code: long long pairs…