Topic: 广求判断素数的算法 |
Print this page |
1.广求判断素数的算法 | Copy to clipboard |
Posted by: zhangp_happy Posted on: 2005-09-25 10:27 这里想向大家讨教判断素数的算法,如果算法雷同就不要发了,小弟想总结 一下判断素数到底有几种算法。大家不要考虑运行的效率问题,有算法就发上来, 当然前提是算法要是正确的。 |
2.Re:广求判断素数的算法 [Re: zhangp_happy] | Copy to clipboard |
Posted by: ranchgirl Posted on: 2005-09-25 10:49 To all: No, please do NOT 发上来!!!! Let him/her do his/her own homework!!!! To zhangp_happy: Hint: do a google search on keywords "How to decide a number is prime! " You would find your own answer guarenteed! Haha, Don't play trick on our members, please! Thanks! |
3.Re:广求判断素数的算法 [Re: zhangp_happy] | Copy to clipboard |
Posted by: 三叶虫 Posted on: 2005-09-27 11:47 我的 密码学课 讲了这个 我还没有编过了 我也想看看有写什么 ??? |
4.Re:广求判断素数的算法 [Re: gongshi] | Copy to clipboard |
Posted by: zhangp_happy Posted on: 2005-09-29 21:01 gongshi wrote: no no no This isn't my homework. "do a google search on keywords "How to decide a number is prime! "" is a good advice thank you but,"Don't play trick on our members" .....Please don't guess otherone's motive before you....... |
5.Re:求1到100素数的算法 [Re: zhangp_happy] | Copy to clipboard |
Posted by: yungoodwin Posted on: 2005-11-12 20:15 import java.lang.Math; public class prime{ public static void main(String args[]) { int n = 0; System.out.println("****100以内的素数****"); outer: for(int i = 2;i<100;i++){ for(int j=2;j<=Math.sqrt;j++){ if(i%j==0) continue outer; } System.out.print("\t"+i); n ++; inner:{ if(n!=9) break inner; System.out.println(); n = 0; } } } } |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |