If the value of ratio is always an integer (is it?) then you can do this:

The largest value that was used is A=Initial x R^[floor(log_{Base R}(N/initial))]. Here floor(x) means rounding x down to the nearest integer. Then subtract Initial x R^A and repeat. Keep going until the remainder is 0.

Here's an example: suppose initial = 3, R= 2, and the sum is 33. The first value is 3 x 2^[floor(log_2 (33/3))] = 3 x 2^[floor(log_2 (11))] = 3 x 2^3 = 24. Now subtract 24 from 33, leaving 9. The next value is 3 x 2^[floor(log_2(9/3))] = 3 x 2^1 = 6. Subtract 6 from 9 leaving 3. The last value is 3 x 2^[floor(log_2(3/3)] = 3x2^0 = 3. Hence the three values used are 24, 6, and 3.

Hope this helps.