You are viewing a single comment's thread. Return to all comments →
What is wrong with this Haskell solution?
pentagonCounterList = [pentagonCounter x | x <- [0..]] pentagonCounter 1 = 1 pentagonCounter 2 = 5 pentagonCounter n = n + 2 * (n-1) + (pentagonCounterList !! (n - 1)) main = do _ <- getLine lines <- getContents let ws = words lines mapM_ (\x -> putStrLn (show (pentagonCounter $ read x))) ws
Failing the last 2 tests.
Seems like cookies are disabled on this browser, please enable them to open this website
Pentagonal Numbers
You are viewing a single comment's thread. Return to all comments →
What is wrong with this Haskell solution?
Failing the last 2 tests.