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.

A257022 Trace of n in the quarter-sum representation of n.

Original entry on oeis.org

0, 1, 2, 1, 4, 1, 6, 1, 2, 9, 1, 2, 12, 1, 2, 1, 16, 1, 2, 1, 20, 1, 2, 1, 4, 25, 1, 2, 1, 4, 30, 1, 2, 1, 4, 1, 36, 1, 2, 1, 4, 1, 42, 1, 2, 1, 4, 1, 6, 49, 1, 2, 1, 4, 1, 6, 56, 1, 2, 1, 4, 1, 6, 1, 64, 1, 2, 1, 4, 1, 6, 1, 72, 1, 2, 1, 4, 1, 6, 1, 2, 81
Offset: 0

Views

Author

Clark Kimberling, Apr 15 2015

Keywords

Comments

Every positive integer is a sum of at most four distinct quarter squares, of which the least term is the trace; see A257019.

Examples

			Quarter-square representations:
r(0) = 0, so a(0) = 0
r(1) = 1, so a(1) = 1
r(2) = 2, so a(2) = 2
r(3) = 2 + 1, so a(3) = 1
		

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[200]; r[0] = {0};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, r[n - g[[n]]]]];
    Table[Last[r[n]], {n, 0, 3 z}] (* A257022 *)