
数论——素性测试
Alex_McAvoy
想要成为渔夫的猎手
展开
-
数论 —— 素性测试
【概述】判断素数是一个较常涉及的内容,所谓素性测试是检测一个数是否为素数的测试。素数定理:,其中 π(x) 表示不超过 x 的素数的个数质数分布密度定理:素数的分布越来越稀疏,当 1E18 内的任意两个素数的差不会很大(不会超过 300)【埃拉托斯特尼筛法】初始时,先假设所有数都是素数,从2开始枚举,当找到一个素数时,显然这个素数乘上另外一个数之后都是合数,把这些合数都筛掉,继...原创 2018-08-01 10:45:03 · 3629 阅读 · 0 评论 -
Minimal Power of Prime(HDU-6623)
Problem DescriptionYou are given a positive integer n > 1. Consider all the different prime divisors of n. Each of them is included in the expansion n into prime factors in some degree. Required...原创 2019-10-07 14:25:44 · 198 阅读 · 0 评论 -
Primes (Gym-102267B)
Problem DescriptionA prime number is a natural number greater than 1 and has exactly 2 divisors which are 1 and the number itself.You are given a prime number nn, find any 2 prime numbers aa and ...原创 2019-08-21 10:12:23 · 602 阅读 · 0 评论 -
Primes on Interval(CF-237C)
Problem DescriptionYou've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer di...原创 2019-08-02 09:19:20 · 225 阅读 · 0 评论 -
哥德巴赫猜想(升级版)(洛谷-P1579)
题目背景1742年6月7日哥德巴赫写信给当时的大数学家欧拉,正式提出了以下的猜想:任何一个大于9的奇数都可以表示成3个质数之和。质数是指除了1和本身之外没有其他约数的数,如2和11都是质数,而6不是质数,因为6除了约数1和6之外还有约数2和3。需要特别说明的是1不是质数。这就是哥德巴赫猜想。欧拉在回信中说,他相信这个猜想是正确的,但他不能证明。从此,这道数学难题引起了几乎所有数学家的...原创 2018-02-28 17:07:23 · 1511 阅读 · 0 评论 -
Prime Gap(POJ-3518)
Problem DescriptionThe sequence of n − 1 consecutive composite numbers (positive integers that are not prime and not equal to 1) lying between two successive prime numbers p and p + n is called a p...原创 2018-08-11 12:23:57 · 321 阅读 · 0 评论 -
Sum of Consecutive Prime Numbers(POJ-2739)
Problem DescriptionSome positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the in...原创 2018-08-10 11:15:41 · 299 阅读 · 0 评论 -
处女座的测验(二)
【题目描述】现在处女座顺利的完成了测验,处女座想要知道知道自己输出的结果是否正确。他希望知道自己有自己输出的数中有多少对是不满足要求的。更具体的,处女座想知道下面程序段的答案int main(){ int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; int a...原创 2019-01-24 22:33:46 · 364 阅读 · 0 评论 -
处女座的测验(一)
【题目描述】处女座进行了一场 c 语言的考试,要求很简单,输出2000个正整数,并且满足以下条件:1.任意两个数互质2.任意两个数 x,y,满足 τ(x*y)>10,其中为 n 的因子的个数举例:6的因子有1,2,3,6,所以 τ(6)=4【输入描述】本题没有输入【输出描述】2000行,每行一个正整数输出的每个整数都必须在1-4*10^8之间如果有多组...原创 2019-03-14 19:38:13 · 282 阅读 · 0 评论 -
Bi-shoe and Phi-shoe(LightOJ-1370)
Problem DescriptionBamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his a...原创 2019-03-18 20:37:21 · 273 阅读 · 0 评论 -
Reversing Encryption(CF-999B)
Problem DescriptionA string ss of length nn can be encrypted by the following algorithm:iterate over all divisors of nn in decreasing order (i.e. from n to 1),for each divisor dd, reverse the su...原创 2018-08-07 17:36:08 · 282 阅读 · 0 评论 -
Prime Cuts(POJ-1595)
Problem DescriptionA prime number is a counting number (1, 2, 3, ...) that is evenly divisible only by 1 and itself. In this problem you are to write a program that will cut some number of prime nu...原创 2018-08-11 12:39:06 · 305 阅读 · 0 评论 -
Goldbach's Conjecture(HDU-1397)
Problem DescriptionGoldbach's Conjecture: For any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such that n = p1 + p2.This conjecture has not...原创 2018-08-11 20:39:19 · 276 阅读 · 0 评论 -
Goldbach's Conjecture(POJ-2262)
Problem DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Every even number greater than 4 can be...原创 2018-08-10 20:04:47 · 473 阅读 · 0 评论 -
Pseudoprime numbers(POJ-3641)
Problem DescriptionFermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Som...原创 2018-08-10 16:34:36 · 353 阅读 · 0 评论 -
回文质数(洛谷-P1217)
题目描述因为151既是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以 151 是回文质数。写一个程序来找出范围[a,b](5 <= a < b <= 100,000,000)( 一亿)间的所有回文质数;输入输出格式输入格式:1 行: 二个整数 a 和 b .输出格式:输出一个回文质数的列表,一行一个。输入输出样例输入样例#1:...原创 2018-02-28 00:06:22 · 1507 阅读 · 0 评论 -
TDL(HDU-6641)
Problem DescriptionFor a positive integern, let's denote functionf(n,m)as them-th smallest integerxthatx>nandgcd(x,n)=1. For example,f(5,1)=6andf(5,5)=11.You are given the value of...原创 2019-10-10 19:44:36 · 221 阅读 · 0 评论