How to calculate sum of digit of a power

69 Views Asked by At

Find the sum of the digits of:

$$\left\lfloor\frac{k^{h+1}-1}{h-1}\right\rfloor$$

I need to calculate sum of digits in answer. Note as $k$ and $h$ can be a very big value, answer is getting overflow.

What is a better way to calculate this?