欧拉项目第十题 Summation of primes
来源:互联网 发布:关键词出价的算法 编辑:程序博客网 时间:2024/06/08 06:29
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
求小于2000000的质数之和
public static void main(String[] args) { ArrayList<Integer> x = new ArrayList<Integer>(); long xx = 2; for(int i=3;i<2000000;i=i+2){ Boolean yh = true; for(Integer ix : x) { if(ix > Math.sqrt(i)) { break; } if(i%ix==0) { yh=false; break; } } if(yh) { xx+=i; x.add(i); yh=true; } } System.out.println(xx); }
0 0
- 欧拉项目第十题 Summation of primes
- 欧拉计划(10)Summation of primes
- summation of four primes
- Problem 10:Summation of primes
- 110705 Summation of Four Primes
- Summation of Four Primes - PC110705
- Problem 10:Summation of primes
- PE 10 Summation of primes
- 10168 Summation of Four Primes
- ProjectEuler-Problem10-Summation of primes
- Problem 10 Summation of primes
- 数论刷题-uva【10168】- Summation of Four Primes
- uva 10168 summation of four primes
- Uva 10168 Summation of Four Primes 素数
- 【Project Euler】【Problem 10】Summation of primes
- (Problem 10)Summation of primes
- project euler problem 10:Summation of primes
- UVA-10168 Summation of Four Primes
- TNS-12560: TNS:protocol adapter error
- Adaptive Deconvolutional Networks for Mid and High Level Feature Learning(阅读)
- ibatis配置详解
- iOS-UIScrollview滑动时标题栏自动隐藏和显示效果
- C指针的一些注意点
- 欧拉项目第十题 Summation of primes
- 《Java程序设计基础》 第4章手记
- eclipse连接数据库及ClassNotFoundException问题
- HOG原理
- oc4j以及gsd服务都处于offline状态,这是Oracle 11g RAC默认情形
- 关于java.lang.IllegalStateException: Fragment already added的问题
- 面试之谈
- ListView------下拉刷新上拉自动加载更多.
- Android开发笔记(七十八)异常容错处理