Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A344624
a(n) = Sum_{k=1..n} k^c(k), where c(n) is the characteristic function of squares.
1
1, 2, 3, 7, 8, 9, 10, 11, 20, 21, 22, 23, 24, 25, 26, 42, 43, 44, 45, 46, 47, 48, 49, 50, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 260
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
Cf. A010052.
Sequence in context: A326979 A326874 A118374 * A154432 A251391 A047361
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, May 24 2021
STATUS
approved