素数判定
更新时间:2023-12-15 18:39:01 阅读量: 教育文库 文档下载
素数判定
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 7 Accepted Submission(s) : 3
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39<=x Input 输入数据有多组,每组占一行,由两个整数x,y组成,当x=0,y=0时,表示输入结束,该行不做处理。 Output 对于每个给定范围内的取值,如果表达式的值都为素数,则输出\否则请输出“Sorry”,每组输出占一行。 Sample Input 0 1 0 0 Sample Output OK Author lcy 分拆素数和 Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 4 Accepted Submission(s) : 3 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 把一个偶数拆成两个不同素数的和,有几种拆法呢? Input 输入包含一些正的偶数,其值不会超过10000,个数不会超过500,若遇0,则结束。 Output 对应每个偶数,输出其拆成不同素数的个数,每个结果占一行。 Sample Input 30 26 0 Sample Output 3 2 Source 2007省赛集训队练习赛(2) How many prime numbers Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 24 Accepted Submission(s) : 7 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Give you a lot of positive integers, just to find out how many prime numbers there are. Input There are a lot of cases. In each case, there is an integer N representing the number of integers to find. Each integer won’t exceed 32-bit signed integer, and each of them won’t be less than 2. Output For each case, print the number of prime numbers you have found out. Sample Input 3 2 3 4 Sample Output 2 Author wangye Source 素数回文 Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 0 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description xiaoou33对既是素数又是回文的数特别感兴趣。比如说151既是素数又是个回文。现在xiaoou333想要你帮助他找出某个范围内的素数回文数,请你写个程序找出 a 跟b 之间满足条件的数。(5 <= a < b <= 100,000,000); Input 这里有许多组数据,每组包括两组数据a跟b。 Output 对每一组数据,按从小到大输出a,b之间所有满足条件的素数回文数(包括a跟b)每组数据之后空一行。 Sample Input 5 500 Sample Output 5 7 11 101 131 151 181 191 313 353 373 383 Author xiaoou333 Source Largest prime factor Time Limit : 5000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 3 Accepted Submission(s) : 3 Font: Times New Roman | Verdana | Georgia Font Size: ← → 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. Input Each line will contain one integer n(0 < n < 1000000). Output Output the LPF(n). Sample Input 1 2 3 4 5 Sample Output 0 1 2 1 3 Author Wiskey Source HDU 2007-11 Programming Contest_WarmUp Deciphering Password Time Limit : 5000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 0 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Xiaoming has just come up with a new way for encryption, by calculating the key from a publicly viewable number in the following way: Let the public key N = AB, where 1 <= A, B <= 1000000, and a0, a1, a2, …, ak-1 be the factors of N, then the private key M is calculated by summing the cube of number of factors of all ais. For example, if A is 2 and B is 3, then N = A = 8, a0 = 1, a1 = 2, a2 = 4, a3 = 8, so the value of M is 1 + 8 + 27 + 64 = 100. However, contrary to what Xiaoming believes, this encryption scheme is extremely vulnerable. Can you write a program to prove it? B Input There are multiple test cases in the input file. Each test case starts with two integers A, and B. (1 <= A, B <= 1000000). Input ends with End-of-File. Note: There are about 50000 test cases in the input file. Please optimize your algorithm to ensure that it can finish within the given time limit. Output For each test case, output the value of M (mod 10007) in the format as indicated in the sample output. Sample Input 2 2 1 1 4 7 Sample Output Case 1: 36 Case 2: 1 Case 3: 4393 Source Humble Numbers Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 0 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers. Write a program to find and print the nth element in this sequence Input The input consists of one or more test cases. Each test case consists of one integer n with 1 <= n <= 5842. Input is terminated by a value of zero (0) for n. Output For each test case, print one line saying \Depending on the value of n, the correct suffix \ordinal number nth has to be used like it is shown in the sample output. Sample Input 1 2 3 4 11 12 13 21 22 23 100 1000 5842 0 Sample Output The 1st humble number is 1. The 2nd humble number is 2. The 3rd humble number is 3. The 4th humble number is 4. The 11th humble number is 12. The 12th humble number is 14. The 13th humble number is 15. The 21st humble number is 28. The 22nd humble number is 30. The 23rd humble number is 32. The 100th humble number is 450. The 1000th humble number is 385875. The 5842nd humble number is 2000000000. The Euler function Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 0 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description The Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller than n and coprime to n, and this function has a lot of beautiful characteristics. Here comes a very easy question: suppose you are given a, b, try to calculate (a)+ (a+1)+....+ (b) Input There are several test cases. Each line has two integers a, b (2 Output Output the result of (a)+ (a+1)+....+ (b) Sample Input 3 100 Sample Output 3042 Source 2009 Multi-University Training Contest 1 - Host by TJU Product of coprimes Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 5 Accepted Submission(s) : 3 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description You are given a positive integer m. Calculate the product of all positive integers less then or equal to m and coprime with m, and give the answer modulo m. Input There are multiple tests end with EOF, each test contains only a positive integer m ≤ 10^9 in a line. The number of tests is no more than 5000. Output In the output file you should write the answer to the task. Sample Input 1 2 3 4 5 6 7 Sample Output 0 1 2 3 4 5 6
正在阅读:
素数判定12-15
汽车构造习题及答案04-01
CO-PC09-27
城市规划听证事项的规定09-22
二年级教材博士奥数教材90页教案学案讲义培优全部整理17讲05-01
重要的一课作文1000字06-27
考研英语形近词辨析整理版04-13
消防调试方案 - 图文09-10
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 素数
- 判定