歌德巴赫猜想.docVIP

  • 5
  • 0
  • 约小于1千字
  • 约 2页
  • 2019-07-23 发布于天津
  • 举报
“歌德巴赫猜想”指出,每个大于6的偶数,都可以表示为两个素数之和。试用程序将6~100内的所有偶数表示为两个素数的和。 import java.util.*; public class e7_19 { public static void main(String []args) { //get prime collection VectorInteger vecPrimer = new Vector(); vecPrimer.add(new Integer(2)); for(int i=3; i=100; i++) { boolean bPrimer = true; int end = (int)Math.sqrt(i); for(int j=2; j=end; j++) { if(i%j == 0) { bPrimer = false; break; } } if(bPrimer) { vecPrimer.add(new Integer(i)); } } //one oushu equal two primer for(int i=6; i=100; i += 2) { for(int j=0; jvecPrimer.size()

文档评论(0)

1亿VIP精品文档

相关文档