Initial upload
This commit is contained in:
13
julia/prime-factors/prime-factors.jl
Normal file
13
julia/prime-factors/prime-factors.jl
Normal file
@@ -0,0 +1,13 @@
|
||||
function prime_factors(n::Int)
|
||||
primes = []
|
||||
while n != 1 && n > 1
|
||||
for i in 2:n
|
||||
if n % i == 0
|
||||
push!(primes, i)
|
||||
n = div(n, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
primes
|
||||
end
|
||||
Reference in New Issue
Block a user