It is a simple algorithm, but without any attempt at code i will not be writting it for you, but i will explain it:
you simply divide the starting number by you base and the remainder is what will be displayed, and the whole part is what you will use to find the next number to display, example:
17 to base 2 (binary)
QUOTE
17 / 2 = 8 R 1
8 / 2 = 4 R 0
4 / 2 = 2 R 0
2 / 2 = 1 R 0 (since we have 1 left)
R 1
now you read this upwards: 10001 is the equivalent, but this works for any base:
17 base 3:
17 / 3 = 5 R 2
5 / 3 = 1 R 2
R 1
there for 17 in base 3 is: 122
once the final division value is less than the base value, you are finished and the division value is the first # in the newly converted base.
*Note that not all bases convert nicely, even numbers definatly work a lot more consistantly than odd numbers.