Created
November 26, 2011 12:22
-
-
Save md2perpe/1395553 to your computer and use it in GitHub Desktop.
Haskell solution for http://blog.tommorris.org/post/13322490041/code-noodling-contest-functionalize-this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pages :: Int -> Int -> [(Int, Int)] | |
pages 1 n = [(1, n)] | |
pages m n = (m, n `div` m) : pages (m `div` 2) (n `mod` m) | |
result :: Int -> [(Int, Int)] | |
result n = pages 16 n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment