Series where each term is in GP along with range calculation.

16 Views Asked by At

Given:

The function has two integer parameters: k and n
The function returns the value of sum

function f(k, n) {
    sum = 0;
    for (i = 1; i ≤ n; i += 1) {
      sum += i;
      i *= k;
    }
    return sum;
}

enter image description here

Is there any mathematical formulae for this question??