Fix EOF
This commit is contained in:
@@ -5,9 +5,9 @@ Created on 24 Jun 2021
|
||||
@email: daviddoji@pm.me
|
||||
|
||||
Solution for Problem 7 of Project Euler
|
||||
https://projecteuler.net/problem=7
|
||||
=#
|
||||
https://projecteuler.net/problem=7 =#
|
||||
|
||||
using BenchmarkTools
|
||||
using Primes
|
||||
|
||||
function Problem7()
|
||||
@@ -15,13 +15,12 @@ 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
|
||||
=#
|
||||
What is the 10_001st prime number =#
|
||||
number = 2
|
||||
primeList = Int[]
|
||||
while length(primeList) < 10_001
|
||||
if isprime(number)
|
||||
append!(primeList,number)
|
||||
append!(primeList, number)
|
||||
end
|
||||
number += 1
|
||||
end
|
||||
@@ -30,7 +29,7 @@ function Problem7()
|
||||
end
|
||||
|
||||
|
||||
println("Time to evaluate Problem 7:")
|
||||
@time Problem7()
|
||||
println("Time to evaluate Problem $(lpad(7, 3, "0")):")
|
||||
@btime Problem7()
|
||||
println("")
|
||||
println("Result for Problem 7: ", Problem7())
|
||||
println("Result for Problem $(lpad(7, 3, "0")): ", Problem7())
|
||||
|
||||
Reference in New Issue
Block a user