
An integer can be expressed in a positional representation with different radices. The most common radix is R = 10; other frequently used radices are 2, 8, 16. Any integer larger than 1 can be used as a radix, but with very large radices we may run out of symbols to represent digits (by convention, if digits 0..9 are insufficient, e.g. in radix 16, lower−case English letters are used to express larger digits: e.g. 'a' denotes a digit of value 10, 'f' denotes a digit of value 15).
Write a function:
function your_function($V,$R);
that returns a string containing the positional representation of the given value V in the given radix R. The representation should be big-endian; i.e. the first character of the string should correspond to the most significant digit of the representation.
For example, if V = 17 and R = 7, the function should return the string "23", because this is the representation of the number 17 in radix 7. If V = 62 and R = 21, the function should return "2k", because this is the representation of the number 62 in radix 21 (note that digit 'k' denotes value 20).
Assume that:
V is an integer within the range [0..200,000,000];
R is an integer within the range [2..36].
Complexity:
expected worst-case time complexity is O(log(V)/log®);
expected worst-case space complexity is O(log(V)/log®).