OFFSET
2,1
COMMENTS
a(n) is calculated starting from n^n and successively subtracting largest possible perfect powers, where those powers range from perfect (n-1)-th power down to perfect square.
At initial n^n, f_1(n) is the largest (n-1)-th power not exceeding n^n. Subtract it to leave remainder n^n - f_1(n). Then f_2(n) is the largest (n-2)-th perfect power not exceeding that remainder, so subtract it to remainder now n^n - f_1(n) - f_2(n). Continue this way through to subtracting f_{n-2}(n) which is the largest perfect square not exceeding the remainder at its point, and leaving result a(n) = n^n - f_1(n) - ... - f_{n-2}(n).
In other words: Subtract from n^n the next smaller power x^(n-1) with the largest x and the result >= 0. Repeat this power reduction and subtract it from the previous result, until x^2, leaving the term a(n). E.g., a(5) = 5^5 - 7^4 - 8^3 - 14^2 = 16.
The definitions f_k(n) and f_t(n) are the k-th and t-th function of the same function f(n).
It appears that log(a(n)) is of the order log(n)^2. (Possibly, log(a(n))/log(n)^2 converges to 1/2.) - Pontus von Brömssen, Nov 11 2021
EXAMPLE
a(5)=16, because
f_1 = ( floor( (5^5 )^(1/4) ) )^4 = 2401,
f_2 = ( floor( (5^5- f_1 )^(1/3) ) )^3 = 512,
f_3 = ( floor( (5^5-(f_1+f_2))^(1/2) ) )^2 = 196,
a(5) = 5^5 - (f_1 + f_2 + f_3) = 3125 -(2401 + 512 + 196) = 16.
MATHEMATICA
f[n_, k_] := Floor[(n^n - Sum[f[n, j], {j, k - 1}])^(1/(n - k))]^(n - k); Array[#^# - Sum[f[#, k], {k, # - 2}] &, 16, 2] (* Michael De Vlieger, Nov 10 2021 *)
PROG
(PARI) a(n) = {my(v=vector(n)); v[1] = n^n; for (i=2, n, v[i] = sqrtnint(v[1] - sum(t=1, i-1, v[t+1]), n-i+1)^(n-i+1); ); v[1] - sum(k=2, n-1, v[k]); } \\ Michel Marcus, Nov 10 2021
(Python)
from sympy import integer_nthroot as introot
from functools import reduce
def A349184(n):
return reduce(lambda x, e:x-introot(x, e)[0]**e, range(n-1, 1, -1), n**n) # Pontus von Brömssen, Nov 11 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Marc Morgenegg, Nov 09 2021
EXTENSIONS
More terms from Michel Marcus, Nov 10 2021
STATUS
approved