diff options
author | mjfernez <mjfernez@gmail.com> | 2020-02-09 15:16:26 -0500 |
---|---|---|
committer | mjfernez <mjfernez@gmail.com> | 2020-02-09 15:16:26 -0500 |
commit | 93ea7fe5957b62f18e8fbd17a21696bd7de6332d (patch) | |
tree | d90aed60d687bcf195f1150777f37cbe8a149814 /sumofprimes.py | |
parent | 125ec5bc3d8bfc224b7d32bcfbbc37b9fb5d441f (diff) | |
download | Project_Euler_Solutions-93ea7fe5957b62f18e8fbd17a21696bd7de6332d.tar.gz |
Organized everything, update README
Diffstat (limited to 'sumofprimes.py')
-rw-r--r-- | sumofprimes.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/sumofprimes.py b/sumofprimes.py deleted file mode 100644 index d0db224..0000000 --- a/sumofprimes.py +++ /dev/null @@ -1,28 +0,0 @@ -import PIL -import math - -# Problem 10 sum of primes - -def prime_factors(number): - primes = [] - if (number <= 1): - return [1] - a = [1] * number - a[0] = 0 - a[1] = 0 # not prime - for i in range(2, int(math.ceil(math.sqrt(number)))): - if(a[i] == 1): - j = i**2 # cross out all the multiples - while(j < number): - a[j] = False - j += i - - for k in range(2, number): - # is prime - if(a[k] == 1): - primes.append(k) - return primes - - -out = prime_factors(2000000) -print(str(sum(out))) |