Skip to content

Instantly share code, notes, and snippets.

@rayyildiz
Created September 5, 2016 07:14
Show Gist options
  • Save rayyildiz/b8e2042b359bb19137ed9a8814d4293b to your computer and use it in GitHub Desktop.
Save rayyildiz/b8e2042b359bb19137ed9a8814d4293b to your computer and use it in GitHub Desktop.
Largest prime factor (Project Euler Question 3)
isPrime :: Integer->Bool
isPrime x = null [y | y<-[2..floor (sqrt (fromIntegral x))], x `mod` y == 0]
divPrime n = [x | x <- [1..n], n `mod` x == 0 && isPrime x]
@rayyildiz
Copy link
Author

rayyildiz commented Sep 5, 2016

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment