title: Project euler problem 3 in haskell
body: <p>I'm new in Haskell and try to solve 3 problem from <a href="http://projecteuler.net/" rel="nofollow">http://projecteuler.net/</a>.</p>
  
  <pre><code>The prime factors of 13195 are 5, 7, 13 and 29.
  
  What is the largest prime factor of the number 600851475143 ?
  </code></pre>
  
  <p>My solution:</p>
  
  <pre><code>import Data.List
  
  getD :: Int -&gt; Int
  getD x = 
    -- find deviders
    let deriveList = filter (\y -&gt; (x `mod` y) == 0) [1 .. x]
        filteredList = filter isSimpleNumber deriveList
    in maximum filteredList
  
  -- Check is nmber simple
  isSimpleNumber :: Int -&gt; Bool
  isSimpleNumber x = let deriveList = map (\y -&gt; (x `mod` y)) [1 .. x]
                         filterLength = length ( filter (\z -&gt; z == 0) deriveList)
                         in 
                            case filterLength of
                              2 -&gt; True
                              _ -&gt; False
  </code></pre>
  
  <p>I try to run for example:</p>
  
  <pre><code>getD 13195
  &gt; 29
  </code></pre>
  
  <p>But when i try:</p>
  
  <pre><code>getD 600851475143
  </code></pre>
  
  <p>I get error Exception: Prelude.maximum: empty list Why?</p>
  
  <p>Thank you @Barry Brown, I think i must use:</p>
  
  <pre><code>getD :: Integer -&gt; Integer
  </code></pre>
  
  <p>But i get error:</p>
  
  <pre><code>Couldn't match expected type `Int' with actual type `Integer'
  Expected type: [Int]
    Actual type: [Integer]
  In the second argument of `filter', namely `deriveList'
  In the expression: filter isSimpleNumber deriveList
  </code></pre>
  
  <p>Thank you.</p>