Skip to content

Instantly share code, notes, and snippets.

@jdiez17
Created December 1, 2014 11:23
Show Gist options
  • Save jdiez17/49b37466143912250d8f to your computer and use it in GitHub Desktop.
Save jdiez17/49b37466143912250d8f to your computer and use it in GitHub Desktop.
module Problem14 where
collatzWriter :: Int -> [Int]
collatzWriter 1 = []
collatzWriter n = next : collatzWriter next
where
next
| n `mod` 2 == 0 = n `div` 2
| otherwise = 3 * n + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment