Function for converting to base b, taking derivative with respect to b and evaluating at b

For your particular problem:

D[IntegerDigits[37, 5] {b^2, b, 1}, b] /. {b -> 5} // Total
12

In general you can create a function:

f[num_, base_] := Module[{}, dig = IntegerDigits[num, base]; len = Length[dig]; 
        D[dig Reverse[b^Range[0, len - 1] ], b] /. {b -> base} // Total]

So that f[37,5] returns 12 and f[988,4] is 923.


db[n_Integer, b_Integer] := 
 FromDigits[(# Range[Length@#, 1, -1]) &@ Most@IntegerDigits[n, b], b]

or

db[n_Integer, b_Integer] :=
 Total@MapIndexed[ ( #2[[1]] - 1 )   #   b^(#2[[1]] - 2) & , 
   Reverse@IntegerDigits[n, b]]

db[37, 5]
db[988, 4]

12

923


f[n_, b_] := Module[{dig},
  dig = IntegerDigits[n, b];
  D[dig.Table[x^i, {i, Length@dig - 1, 0, -1}], x] /. x -> b
  ]

Maybe a different example for illustration:

f[2016, 28]

128