Hi everyone,
Julia newbie here In my attempt to solve the following problem using Julia, which is almost a copy of a solution I came up using Python, I’m obviously not entering in the second while-loop (the println statement shows the ans variable-1).
Still lot to learn
function Problem3()
#=
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
=#
global ans = 600_851_475_143
global factor = 2
while factor * factor < ans
#println(ans)
while ans % factor == 0
ans = ans ÷ factor
factor += 1
end
end
return ans
end
Any help would be appreciated