This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A350178 #40 Apr 27 2025 17:15:12 %S A350178 0,0,1,3,0,1,3,6,4,0,1,3,6,4,6,9,0,1,3,6,4,6,9,13,12,0,1,3,6,4,6,9,13, %T A350178 12,9,11,0,1,3,6,4,6,9,13,12,9,11,14,18,0,1,3,6,4,6,9,13,12,9,11,14, %U A350178 18,17,20,0,1,3,6,4,6,9,13,12,9,11,14,18,17,20,24,16,0,1,3,6,4,6,9,13 %N A350178 Take n and subtract the greatest square less than or equal to n. Repeat this process until 0 is reached. a(n) is the sum of all residues after subtractions. %C A350178 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. %C A350178 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,... . %H A350178 Thomas Scheuerle, <a href="/A350178/b350178.txt">Table of n, a(n) for n = 0..5000</a> %F A350178 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. %F A350178 a(n) = Sum_{k>0} A053186^k(n). %e A350178 a(41): 41 - 6^2 = 5; 5 - 2^2 = 1; 1 - 1^2 = 0 -> 5+1 = 6 = a(41). %t A350178 Table[Total[Rest[NestWhileList[#-Floor[Sqrt[#]]^2&,n,#>0&]]],{n,0,90}] (* _Harvey P. Dale_, Apr 27 2025 *) %o A350178 (PARI) A350178(n)={my(r=0); while(n-=sqrtint(n)^2, r+=n); r}; %Y A350178 Cf. A053186, A053610. %K A350178 nonn,hear %O A350178 0,4 %A A350178 _Thomas Scheuerle_, Dec 18 2021