This commit is contained in:
David Doblas Jiménez
2021-09-20 18:08:16 +02:00
parent 2a1db7eda3
commit 86aff084d8
49 changed files with 2254 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
#=
Created on 24 Jun 2021
@author: David Doblas Jiménez
@email: daviddoji@pm.me
Solution for Problem 7 of Project Euler
https://projecteuler.net/problem=7
=#
using Primes
function Problem7()
#=
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13,
we can see that the 6th prime is 13.
What is the 10_001st prime number
=#
number = 2
primeList = Int[]
while length(primeList) < 10_001
if isprime(number)
append!(primeList,number)
end
number += 1
end
return primeList[length(primeList)]
end
println("Time to evaluate Problem 7:")
@time Problem7()
println("")
println("Result for Problem 7: ", Problem7())