Pergunta de entrevista da empresa DNAnexus

Create a function converting a decimal number to a different base. Describe and algorithm.