Location:
Search - isprime
Search list
Description: 判断是不是大素数,的快速算法,适用于公钥加密算法-judgment is not large prime numbers, the fast algorithm applicable to the public key encryption algorithm
Platform: |
Size: 8286 |
Author: wanggang |
Hits:
Description: 素数判断方法的多种方法实现,这些方法可以较好的拓展思路,对C++的学习有帮助
Platform: |
Size: 2215 |
Author: 陈军 |
Hits:
Description: 测试是否为质数,小东西而已,见笑大方之家了。
Platform: |
Size: 6413 |
Author: hello |
Hits:
Description: public class gedebahe { public static void main( String [] args) { for ( ) { int a=-1,b,c //b,c是分解出来的两个数 System.out.print(\"Please input a oushu:\") //输入一个偶数 try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) String inputLine = in.readLine() a = Integer.valueOf(inputLine).intValue() }catch (Exception exc) { System.out.println(\"Sorry,please input a number.\") return } if (a%2!=0) { System.out.println(\"Sorry,please input a oushu.\") return } for (b=1 b<a b++) { c=(a-b) if(isPrime(b)&&isPrime(c)) { System.out.println(a+\"=\"+b+\"+\"+c) break } } } } public static boolean isPrime(int k)//方法用来判断一个数是否为偶数 { int a boolean t = true if (k==1) return t for (a=2 a<k a++) { if (k%a==0) break } if (a!=k) t=false return t-gedebahe public class (public static void main (String [] args) (for () (int a = a, b, c / / b, c is the decomposition of the two several System.out.print ( "Please input a oushu : ") / / input an even try (BufferedReader in = new BufferedReader (new InputStreamReader (System.in)) = String inputLine in.readLine () a = Integer.valueOf (inputLine). intValue ()) catch (Exception exc) ( System.out.println ( "Sorry, please input a number.") return) if (a 2%! = 0) (System.out.println ( "Sorry, please input a oushu.") return) for (b = a blt; a b) (c = (a-b) if (isPrime (b) isPrime (c)) (System.out.println (a "=" b "" c) break)))) public static boolean isPrime (int k) / / method used to determine whether a number is even (int a boolean true if t =
Platform: |
Size: 881 |
Author: 康健伟 |
Hits:
Description: public class gedebahe { public static void main( String [] args) { for ( ) { int a=-1,b,c //b,c是分解出来的两个数 System.out.print("Please input a oushu:") //输入一个偶数 try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) String inputLine = in.readLine() a = Integer.valueOf(inputLine).intValue() }catch (Exception exc) { System.out.println("Sorry,please input a number.") return } if (a%2!=0) { System.out.println("Sorry,please input a oushu.") return } for (b=1 b<a b++) { c=(a-b) if(isPrime(b)&&isPrime(c)) { System.out.println(a+"="+b+"+"+c) break } } } } public static boolean isPrime(int k)//方法用来判断一个数是否为偶数 { int a boolean t = true if (k==1) return t for (a=2 a<k a++) { if (k%a==0) break } if (a!=k) t=false return t-gedebahe public class (public static void main (String [] args) (for () (int a = a, b, c// b, c is the decomposition of the two several System.out.print ( "Please input a oushu : ")// input an even try (BufferedReader in = new BufferedReader (new InputStreamReader (System.in)) = String inputLine in.readLine () a = Integer.valueOf (inputLine). intValue ()) catch (Exception exc) ( System.out.println ( "Sorry, please input a number.") return) if (a 2%! = 0) (System.out.println ( "Sorry, please input a oushu.") return) for (b = a blt; a b) (c = (a-b) if (isPrime (b) isPrime (c)) (System.out.println (a "=" b "" c) break)))) public static boolean isPrime (int k)// method used to determine whether a number is even (int a boolean true if t =
Platform: |
Size: 1024 |
Author: 康健伟 |
Hits:
Description: 判断是不是大素数,的快速算法,适用于公钥加密算法-judgment is not large prime numbers, the fast algorithm applicable to the public key encryption algorithm
Platform: |
Size: 8192 |
Author: wanggang |
Hits:
Description: 素数判断方法的多种方法实现,这些方法可以较好的拓展思路,对C++的学习有帮助-Prime number judging method to achieve a variety of methods, these methods can be a good idea to expand on the C++ Learning help
Platform: |
Size: 2048 |
Author: 陈军 |
Hits:
Description: 测试是否为质数,小东西而已,见笑大方之家了。-Test whether the quality of a few, small things only the laughing stock of the generous home.
Platform: |
Size: 15360 |
Author: |
Hits:
Description: 定义一个名为Integer的类,具有数据成员d,成员函数GetD()获取d的值,SetD(int)设置d的值,IsOdd()判断d是否为偶数,IsPrime()判断d是否为一个素
数,并设计主函数用一个对象分别设置d的值为15和31,测试这个类 -, and to design the main function of an object with the value of d were set to 15 and 31, to test the class
Platform: |
Size: 12288 |
Author: 张尧林 |
Hits:
Description: 编写筛选查找素数函数:
void sieve(bool isPrime[], int n)
其中isPrime[ ]为一个布尔型数组,n为数组大小。由于2是第一个素数,
所以设置isPrime[0]和isPrime[1]的值为false,并设置其余的元素初值为true。
然后对从4到n-1的每一个i,判断i是否能够被2整除,如果i能够被2整除,则设置isPrime[i]为false。
对从2到n/2的每一个可能的数值重复以上处理,当操作结束时,所有值为true的isPrime[i]所对应的i就是素数,它们将是从筛子中掉下来的。-Find prime numbers prepared by screening the function: void sieve (bool isPrime [], int n) which isPrime [] as a Boolean array, n is the size of the array. Because 2 is the first prime number, so set the isPrime [0], and isPrime [1] a value of false, and set the initial value of the remaining elements of true. And then from 4 to n-1 for each i, to determine whether i can be divisible by 2, if i can be divisible by 2, then set the isPrime [i] is false. From 2 to n/2 possible values for each one to repeat the above processing, when the operation ended, all the true value of the isPrime [i] corresponding to i is a prime number, they will be falling from the sieve in the past.
Platform: |
Size: 1176576 |
Author: 闻悦 |
Hits:
Description: 用isprime方法找到并输出前一千个素数,并且每行显示十个-use the isprime to find the first thousand primes and replay them in the way of ten per row.
Platform: |
Size: 3072 |
Author: xuzhihong |
Hits:
Description: 通过字符串操作模拟控制台的cd命令,要求至少完成 “cd 【目录名】”、“cd ..” 和“cd \” 三个命令。实例可以参考:开始->运行->cmd->键入上述三个命令观察提示符前的字符串变化,帮助可通过cd /?显示;可使用字符串处理函数。并用此程序练习和熟悉调试过程。
实验014:重写实验007和012,要求使用函数IsPrime实现判断一个数是否是素数,GCD返回两个数的最大公约数,LCM返回两个数的最小公倍数,并在main中调用。-Through the string of CD command console operation simulation, require at least finish "CD [directory name]", "CD.." And "CD \" three orders. Examples can reference: start- > > > CMD- running- the above three orders typed observation prompt before the string change, help by CD /? Display Can use string processing function. The use of this procedure practice and familiar with the debugging process.
Experimental 014: rewrite experimental 007 and I use function, the requirement IsPrime realize whether a number is a prime, the GCD returns the maximum two Numbers, LCM returns when the minimum two Numbers in LCD, and main invokes.
Platform: |
Size: 175104 |
Author: zhu |
Hits:
Description: Prime algoritm Sieve and isPrime
Platform: |
Size: 86016 |
Author: ismail |
Hits:
Description: 关于一个JAVA的核心语法的一个小练习,是使用JAVA实现判断一个数是否为素数。-A little practice on a JAVA core of syntax, the use of JAVA to judge whether a number is prime.
Platform: |
Size: 2048 |
Author: xuejh |
Hits:
Description: 自己编写的简单素数(质数)判断函数,文件已带使用说明//编 写 人:Chernic//学 校:广州大学//联系邮箱:iamchernic@gmail.com-I have written a simple primes (prime) to determine the function// Write the person: Chernic// School: Guangzhou University// Contact E-mail: iamchernic@gmail.com
Platform: |
Size: 1024 |
Author: |
Hits:
Description: excel文件中Decide宏为判断是否素数,Decompose宏为分解素因数。-The Decide macro in the excel file to determine whether the prime, Decompose macro for the decomposition of prime factor.
Platform: |
Size: 13312 |
Author: starsky |
Hits:
Description: 1. 编写筛选查找素数函数:
void sieve(bool isPrime[], int n)
其中isPrime[n]为一个布尔型数组,n为数组大小。由于2是第一个素数,所以设置isPrime[0]和isPrime[1]的值为false,并设置其余的元素初值为true。然后对从4到n-1的每一个i,判断i是否能够被2整除,如果i能够被2整除,则设置isPrime[i]为false。对从2到n/2的每一个可能的数值重复以上处理,当操作结束时,所有值为true的isPrime[i]所对应的i就是素数,它们将是从筛子中掉下来的。
测试程序:
输入:一个整数,表示n
输出:1行,1到n之间的所有素数,两个素数之间用空格隔开,最后一个素数输出后,输出一个空格和空行,输出参见函数Disp的代码。
例如,当输入20时,输出如下:
2 3 5 7 11 13 17 19
-1. Preparation of screening to find primes function: void sieve (bool isPrime [], int n) where isPrime [n] is a Boolean array, n is the array size. Because 2 is the first prime number, so set isPrime [0] and isPrime [1] the value is false, and set the rest of the elements of the initial value to true. Then 4 to n-1 every i, i determine whether it can be divisible by 2, if i can be divisible by 2, set isPrime [i] is false. For every possible value 2 to n/2 Repeat the above process, when the end of the operation, all the value of true isPrime [i] corresponding to the i is a prime number, they will be falling the sieve come. Test Procedure: Input: An integer representing the n output: 1 line, all the prime numbers between 1 and n, separated by a space between two prime number, a prime number after the last output, the output of a blank and blank lines, see the output function Disp code. For example, when the input 20, the output is as follows: 235711131719
Platform: |
Size: 117760 |
Author: 光 |
Hits:
Description: 判断一个数是否为质数,使用BigInteger结构,进行大数的运算-To judge whether a number is prime, the use of BigInteger structure is very useful for large numbers of computing
Platform: |
Size: 45056 |
Author: 琳琳 |
Hits:
Description: delphixe7并行库的使用,帮助大家对新的并行库编程有个初步的认识-the use of the new parallel library of delphixe7,help others to realize the new library.
Platform: |
Size: 3456000 |
Author: 王欣 |
Hits:
Description: isPrime function, to learn javascript recursivity
Platform: |
Size: 23552 |
Author: heavyhide
|
Hits: