Specify data type on list creation for performance

This commit is contained in:
David Doblas Jiménez 2021-07-22 11:31:20 +02:00
parent 45338f7fdd
commit 7e6e92b13e

View File

@ -37,7 +37,7 @@ function Problem12()
function num_divisors(n)
res = floor(Int, sqrt(n))
divs = []
divs = Int[]
for i = 1:res
if n % i == 0
append!(divs, i)