Print integers in any base up to 36 Possible Duplicate:
  Integer to string with given radix  




This question is inspired by Pythons builtin int function. int is used to convert other numbers or strings into integers. If you are converting a string you can provide the additional parameter base, that contains the base that your number is represented in within the string:

&gt;&gt;&gt; int('137')
137
&gt;&gt;&gt; int('137',base=8)
95
&gt;&gt;&gt; int('ff',base=16)
255
&gt;&gt;&gt; int('1AZ',base=36)
1691


Unfortunately Python doesn't provide a function for the reverse case, where you want to convert a number into a string in a specific base.

Your task is to write such a function.


the function may return the value or print it
you must provide support for all bases between 2 and 36
digits to use are 0123456789abcdefghijklmnopqrstuvwxyz
all languages are allowed
built in functions for this purpose are boring and thus forbidden
shortest code wins
Befunge, 17x4 = 68 characters

1-&amp;00p&amp;&gt;:!#v_:00v
v-10&lt;  ^/g00\%g &lt;
&lt; &gt;:^@_.# #$v#:!`
"_^#`9::$  &lt;&lt;,+"W


Online interpreter: http://www.bedroomlan.org/tools/befunge-93-playground

First input is base, second is number.

Similar to other solutions here this does not output anything when the number is 0.  I may look at fixing this at some point.