Added a function to extract the digits from a number in a given base and a test for it.