OFFSET
0,4
COMMENTS
Let s_1,s_2,s_3,...,s_m be the greedy partition of n into squares (n = s_1+s_2+s_3+...+s_m) such that s_1 >= s_2 >= s_3 >= ... >= s_m then a(n) = 0*s_1 + 1*s_2 + 2*s_3 + ... + (m-1)*s_m.
This sequence contains only numbers which can be written in the form c_1^2 + 2*c_2^2 + ... + m*c_m^2 with c_1 >= c_2 >= c_m. This excludes 2,5,7,8,... .
LINKS
Thomas Scheuerle, Table of n, a(n) for n = 0..5000
FORMULA
a(n) = n - r^2 + a(n - r^2) = a(n - r^2 + (b + r)^2) = a(n + b^2 + 2*b*r), r = floor(sqrt(n)), for any b >= 0. True because a(n) depends only on the distance to the next square <= n.
a(n) = Sum_{k>0} A053186^k(n).
EXAMPLE
a(41): 41 - 6^2 = 5; 5 - 2^2 = 1; 1 - 1^2 = 0 -> 5+1 = 6 = a(41).
PROG
(PARI) A350178(n)={my(r=0); while(n-=sqrtint(n)^2, r+=n); r};
CROSSREFS
KEYWORD
nonn,hear
AUTHOR
Thomas Scheuerle, Dec 18 2021
STATUS
approved