login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of squares in the quarter-sum representation of n.
5

%I #4 Apr 15 2015 15:44:12

%S 1,1,0,1,1,2,0,1,0,1,2,1,0,1,0,1,1,2,1,2,0,1,0,1,1,1,2,1,2,2,0,1,0,1,

%T 1,2,1,2,1,2,2,3,0,1,0,1,1,2,0,1,2,1,2,2,3,1,0,1,0,1,1,2,0,1,1,2,1,2,

%U 2,3,1,2,0,1,0,1,1,2,0,1,0,1,2,1,2,2

%N Number of squares in the quarter-sum representation of n.

%C Every positive integer is a sum of at most four distinct quarter squares; see A257019.

%H Clark Kimberling, <a href="/A257024/b257024.txt">Table of n, a(n) for n = 0..1000</a>

%e Quarter-square representations:

%e r(5) = 4 + 1, so a(5) = 2;

%e r(11) = 9 + 2, so a(11) = 1;

%e r(35) = 30 + 4 + 1, so a(35) = 2.

%t z = 100; b[n_] := Floor[(n + 1)^2/4]; bb = Table[b[n], {n, 0, 100}];

%t s[n_] := Table[b[n], {k, b[n + 1] - b[n]}];

%t h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];

%t g = h[100]; Take[g, 100]; r[0] = {0};

%t r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, r[n - g[[n]]]]]

%t sq = Table[n^2, {n, 0, 1000}]; t = Table[r[n], {n, 0, z}]

%t u = Table[Length[Intersection[r[n], sq]], {n, 0, 250}]

%Y Cf. A002620, A257019, A257020, A257021, A257022.

%K nonn,easy

%O 0,6

%A _Clark Kimberling_, Apr 15 2015