One strategy to is convert from the starting base to base 10, then to do partition with a tree.
Here's an example: Convert 6257 to base 3.
Links: