Skip to content

Commit

Permalink
Refactor away tiny largest-prime-factor function
Browse files Browse the repository at this point in the history
  • Loading branch information
selik committed Jul 13, 2014
1 parent d0858c6 commit cc3cf30
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/euler_clj/core.clj
Expand Up @@ -71,15 +71,10 @@
(filter (partial multiple? n)
(take-while (partial >= (inc (int (Math/sqrt n)))) (primes))))

(defn largest-prime-factor
"Largest prime factor of a number; 1 if the number is prime"
[n]
(apply max (cons 1 (prime-factors n))))

(defn problem-003
"Largest prime factor of 600851475143"
[]
(largest-prime-factor 600851475143))
(apply max (cons 1 (prime-factors 600851475143))))

(defn solve-euler
"Format the answer to Problem N as a string"
Expand Down

0 comments on commit cc3cf30

Please sign in to comment.