Let say I have two numbers n power r. How can we find sums of all powers. For example if n = 3 and r 3 then we can calculate manually like this
3 ^ 3 = 27 3 ^ 2 = 9 3 ^ 1 = 3 Sum = 39
Can we formulate this? I mean can we create a function which takes n and r and returns this sum?
I have background in programming but don't know maths 🙂 . I know using any programming language we can write a function which can calculate sum using loops or recursion but is there any other solution so I find sum without loops or recursion.
Thanks in advance