It seems if base number $a$ is a natural number and the exponent $n$ is an odd number greater than or equal to $3$, then:
$f(a, n) =\displaystyle\sum_{i=1}^{a^{n-(n+1)/2}}{(2ai-a)}=a^n$
Such as $f(3, 7) = 2187 = 3 ^ 7$
How does this sum work? How about if the exponent is an even number?
Source: "Linearization" of Beal problem