What is a good algorithm for calculating the value of the i-th digit in the k-ary representation of n?
Example:
For the function bitval(int k, int i, int n) :
bitval(5, 4, 9730) = 2 , because in the 5-ary representation of 9730 (302410), the 4th digit (on the right) is 2.
source share