OFFSET
1,2
COMMENTS
For 1 <= k <= n, take a running total: add k if k is a perfect square, otherwise add 1. For example, a(12) = 1+1+1+4+1+1+1+1+9+1+1+1 = 23.
FORMULA
a(n) = n+m*(m-1)*(2*m+5)/6 where m = floor(sqrt(n)). - Chai Wah Wu, May 24 2021
MATHEMATICA
Table[Sum[i^(Floor[Sqrt[i]] - Floor[Sqrt[i - 1]]), {i, n}], {n, 80}]
PROG
(Python 3.8+)
from math import isqrt
def A344624(n):
m = isqrt(n)
return n + m*(m-1)*(2*m+5)//6 # Chai Wah Wu, May 24 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, May 24 2021
STATUS
approved