Add julia solution and fasten bash solution for problem 10 #1
1 changed files with 4 additions and 5 deletions
|
@ -3,12 +3,11 @@ import Primes
|
||||||
function sumprimes(n::Int)
|
function sumprimes(n::Int)
|
||||||
#primnumbers = SharedArray{Int}(n)
|
#primnumbers = SharedArray{Int}(n)
|
||||||
primesum=2
|
primesum=2
|
||||||
parasum += @parallel (+) for i in 3:2:n
|
parasum = @parallel (+) for i in 3:2:n
|
||||||
Primes.isprime(i)*i
|
Primes.isprime(i)*i
|
||||||
end
|
end
|
||||||
primesum
|
primesum+=parasum
|
||||||
end
|
end
|
||||||
sumprimes(11)
|
sumprimes(10)
|
||||||
print(2)
|
@time prime = sumprimes(2000000)
|
||||||
@time prime = sumprimes(7)
|
|
||||||
print(prime)
|
print(prime)
|
||||||
|
|
Reference in a new issue