Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Created November 26, 2011 12:22
Show Gist options
  • Save md2perpe/1395553 to your computer and use it in GitHub Desktop.
Save md2perpe/1395553 to your computer and use it in GitHub Desktop.
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