Commits

Lars Yencken committed e60ab7b

Simplify Julia 03.

Comments (0)

Files changed (1)

julia/03-prime-factors.jl

 #
 
 """
-Calculate the largest prime fator of 600851475143.
+Calculate the largest prime factor of 600851475143.
 """
 
-function factorize(x)
-    factors = Set{Int64}()
+#function factorize(x)
+    #factors = Set{Int64}()
 
-    while x > 1
-        for i = 2:x + 1
-            if x % i == 0
-                add!(factors, i)
-                x = div(x, i)
-                break
-            end
-        end
-    end
+    #while x > 1
+        #for i = 2:x + 1
+            #if x % i == 0
+                #add!(factors, i)
+                #x = div(x, i)
+                #break
+            #end
+        #end
+    #end
 
-    factors
-end
+    #factors
+#end
 
-println(max(factorize(600851475143)))
+#println(max(factorize(600851475143)))
+
+println(max(keys(factor(600851475143))))