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
If you take out $a$ as a common factor, what is left is the sum of all odd numbers from $1$ to $2b-1$, where $b=a^{n-(n+1)/2}$. It is well known that this sum is $b^2$, so the total is $$f(a,n)=ab^2=a\Bigl(a^{n-(n+1)/2}\Bigr)^2=a\times a^{2n-n-1}=a^n\ .$$
If $n$ is even then $n-\frac{n+1}{2}$ is not an integer, so $a^{n-(n+1)/2}$ is not an integer (usually: $a$ might be square). So the upper limit of summation would have to be $$\Bigl\lfloor a^{n-(n+1)/2}\Bigr\rfloor\ ;$$ the same argument gives $$f(a,n)=a\Bigl\lfloor a^{n-(n+1)/2}\Bigr\rfloor^2\ ,$$ but it may not be easy to simplify this.