Advertisement
clairec

Untitled

Sep 27th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. -- blockSize m b = the number of base-b digits that can be represented by
  2. -- an Integer < m. Hint: calculate this by repeatedly multiplying 1 by b
  3. -- until you get >= m, returning one less than the number of multiplications
  4. blockSize :: Integer -> Int -> Int
  5. blockSize m b = mult' 1 0
  6. where mult' a c
  7. | a >= m = c-1
  8. | otherwise = mult' (a * toInteger b) (c+1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement