cp's OEIS Frontend

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.

A257021 Numbers whose quarter-square representation consists of four terms.

Original entry on oeis.org

255, 271, 287, 304, 321, 339, 357, 376, 395, 399, 415, 419, 435, 439, 456, 460, 477, 481, 499, 503, 521, 525, 544, 548, 567, 571, 575, 591, 595, 599, 615, 619, 623, 640, 644, 648, 665, 669, 673, 691, 695, 699, 717, 721, 725, 744, 748, 752, 771, 775, 779, 799
Offset: 1

Views

Author

Clark Kimberling, Apr 15 2015

Keywords

Comments

Every positive integer is a sum of at most four distinct quarter squares (see A257019).

Examples

			Quarter-square representations:
r(255) = 240 + 12 + 2 + 1; four terms
r(6969) = 6889 + 72 + 6 + 2; four terms
		

Crossrefs

Programs

  • Mathematica
    z = 100; b[n_] := Floor[(n + 1)^2/4]; bb = Table[b[n], {n, 0, 100}];
    s[n_] := Table[b[n], {k, b[n + 1] - b[n]}];
    h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
    g = h[100]; r[0] = {0};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, r[n - g[[n]]]]];
    u = Table[Length[r[n]], {n, 0, 4 z}];(* A257023 *)
    Flatten[-1 + Position[u, 1]]; (* A002620 *)
    Flatten[-1 + Position[u, 2]]; (* A257019 *)
    Flatten[-1 + Position[u, 3]]; (* A257020 *)
    Flatten[-1 + Position[u, 4]]; (* A257021 *)