Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

Untitled

By: a guest on Feb 2nd, 2010  |  syntax: Haskell  |  size: 0.39 KB  |  hits: 70  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. import Primes
  2. import Control.Arrow
  3. import Data.List
  4. import Data.Ord
  5.  
  6. naturals = [0, 1..]
  7. quadratics a b = [x * x + a * x + b | x <- naturals]
  8.  
  9. quadraticPrimes a b = takeWhile isPrime $ quadratics a b
  10.  
  11. qps = [(quadraticPrimes a b, a*b) | a <- [-1000..1000], b <- [-1000..1000]]
  12.  
  13. a <* b = length a `compare`  length b
  14.  
  15. main = putStr . show . snd . last $ sortBy (\a b -> fst a <* fst b) qps