fork download
  1. import Data.Complex
  2. import Data.List
  3. main :: IO ()
  4. main = mapM_ (print . f) $ 999 : 1000 : 20 : [1 .. 6]
  5. f :: Int -> Double
  6. f n = (!! n) $ nub $ sort [magnitude $ x :+ y | x <- a, y <- a]
  7. where a = map fromIntegral [0..ceiling $ sqrt $ fromIntegral $ 4 * n]
  8.  
Success #stdin #stdout 0.04s 6316KB
stdin
Standard input is empty
stdout
58.0
58.008620049092706
6.324555320336759
1.0
1.4142135623730951
2.0
2.23606797749979
2.8284271247461903
3.0