Project Euler 10 Summation of primes
2013-10-08 13:40
363 查看
Project Euler 10 Summation of primes
#!/usr/bin/env python #-*- coding: utf-8 -*- ''' The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. ''' from math import * def isPrime(num): if num < 2: return False if num == 2: return True if num%2 == 0: return False i = 3 while( i*i <= num): if num%i == 0: return False i += 2 return True i=2 s=0 while i<=2000000: if isPrime(i)==True: s+=i print i,s i+=1
相关文章推荐
- 【Project Euler】【Problem 10】Summation of primes
- project euler 10 Summation of primes
- projecteuler---->problem=10----Summation of primes
- Problem 10 Summation of primes
- Project Euler 010 Summation of primes
- project euler problem 10:Summation of primes
- projecteuler---->problem=10----Summation of primes
- Project Euler Problem 10: Summation of primes
- UVa 10168 Summation of Four Primes
- PC/UVa 110705/10168 Summation of Four Primes
- UVaOJ-10168-Summation of Four Primes 解题报告
- UVA 10168 Summation of Four Primes(数论)
- UVA 10168 Summation of Four Primes(数论)
- 110705 Summation of Four Primes
- 10 Summation of primes - Project Euler
- UVa 10168 Summation of Four Primes (“1+1+1+1”问题)
- UVa Problem Solution: 10168 - Summation of Four Primes
- 10168 Summation of Four Primes
- 数论刷题-uva【10168】- Summation of Four Primes
- UVA-10168 Summation of Four Primes 哥德巴赫猜想