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.

Showing 1-6 of 6 results.

A256789 R(k), the minimal alternating squares representation of k, concatenated for k = 0, 1, 2,....

Original entry on oeis.org

0, 1, 4, -2, 4, -1, 4, 9, -4, 9, -4, 1, 9, -4, 2, 9, -1, 9, 16, -9, 4, -1, 16, -9, 4, 16, -4, 16, -4, 1, 16, -4, 2, 16, -1, 16, 25, -9, 1, 25, -9, 4, -2, 25, -9, 4, -1, 25, -9, 4, 25, -4, 25, -4, 1, 25, -4, 2, 25, -1, 25, 36, -16, 9, -4, 1, 36, -9, 36, -9, 1
Offset: 0

Views

Author

Clark Kimberling, Apr 13 2015

Keywords

Comments

Let B(n) be the least square >= n. The minimal alternating squares representation of a nonnegative integer n is defined as the sum B(n) - B(m(1)) + B(m(2)) + ... + d*B(m(k)) that results from the recurrence R(n) = B(n) - R(B(n) - n), with initial representations R(0) = 0, R(1) = 1, and R(2) = 4 - 2. The sum B(n) + B(m(2)) + ... is the positive part of R(n), and the sum B(m(1)) + B(m(3)) + ... is the nonpositive part of R(n). The last term of R(k) is the trace of n. If b(n) = n*(n+1)/2, the n-th triangular number, then the sum R(n) is the minimal alternating triangular-number representation of n.
Unlike minimal alternating representations for other bases (e.g., Fibonacci numbers, A256655; binary, A256696, triangular numbers, A244974), the trace of a minimal alternating squares representation is not necessarily a member of the base; specifically, the trace can be -2 or 2, which are not squares.

Examples

			R(0) = 0
R(1) = 1
R(2) = 4 - 2
R(3) = 4 - 1
R(4) = 4
R(5) = 9 - 4
R(6) = 9 - 4 + 1
R(7) = 9 - 4 + 2
R(89) = 100 - 16 + 9 - 4
		

Crossrefs

Cf. A000290, A256655, A256696, A244974, A256790 (number of terms), A256791 (trace).

Programs

  • Mathematica
    b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}];
    s[n_] := Table[b[n], {k, 1, 2 n - 1}];
    h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
    g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
    Table[r[n], {n, 0, 120}]  (* A256789, individual representations *)
    Flatten[Table[r[n], {n, 0, 120}]] (* A256789, concatenated representations *)

A256792 Numbers whose minimal alternating squares representation has positive trace.

Original entry on oeis.org

1, 4, 6, 7, 9, 11, 13, 14, 16, 17, 20, 22, 23, 25, 26, 28, 31, 33, 34, 36, 37, 39, 41, 44, 46, 47, 49, 52, 54, 56, 59, 61, 62, 64, 66, 69, 71, 73, 76, 78, 79, 81, 82, 85, 88, 90, 92, 95, 97, 98, 100, 102, 103, 106, 109, 111, 113, 116, 118, 119, 121, 123, 125
Offset: 1

Views

Author

Clark Kimberling, Apr 13 2015

Keywords

Comments

See A256789 for definitions.

Examples

			R(1) = 1; trace = 1, positive.
R(2) = 4 - 2; trace = -2, negative.
R(3) = 4 - 1; trace = -1, negative.
		

Crossrefs

Cf. A256789, A256793 (complement).

Programs

  • Mathematica
    b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}];
    s[n_] := Table[b[n], {k, 1, 2 n - 1}];
    h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
    g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
    Table[r[n], {n, 0, 120}] (* A256789 *)
    u = Flatten[Table[Last[r[n]], {n, 1, 1000}]];  (* A256791 *)
    Select[Range[800], u[[#]] > 0 &] (* A256792 *)
    Select[Range[800], u[[#]] < 0 &] (* A256793 *)

A256793 Numbers whose minimal alternating squares representation has positive trace.

Original entry on oeis.org

2, 3, 5, 8, 10, 12, 15, 18, 19, 21, 24, 27, 29, 30, 32, 35, 38, 40, 42, 43, 45, 48, 50, 51, 53, 55, 57, 58, 60, 63, 65, 67, 68, 70, 72, 74, 75, 77, 80, 83, 84, 86, 87, 89, 91, 93, 94, 96, 99, 101, 104, 105, 107, 108, 110, 112, 114, 115, 117, 120, 122, 124
Offset: 1

Views

Author

Clark Kimberling, Apr 13 2015

Keywords

Comments

See A256789 for definitions.

Examples

			R(1) = 1; trace = 1, positive.
R(2) = 4 - 2; trace = -2, negative.
R(3) = 4 - 1; trace = -1, negative.
		

Crossrefs

Cf. A256789, A256792 (complement).

Programs

  • Mathematica
    b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}];
    s[n_] := Table[b[n], {k, 1, 2 n - 1}];
    h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
    g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
    Table[r[n], {n, 0, 120}] (* A256789 *)
    u = Flatten[Table[Last[r[n]], {n, 1, 1000}]];  (* A256791 *)
    Select[Range[800], u[[#]] > 0 &] (* A256792 *)
    Select[Range[800], u[[#]] < 0 &] (* A256793 *)

A256794 First differences of A256792.

Original entry on oeis.org

3, 2, 1, 2, 2, 2, 1, 2, 1, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 2, 3, 2, 1, 2, 3, 2, 2, 3, 2, 1, 2, 2, 3, 2, 2, 3, 2, 1, 2, 1, 3, 3, 2, 2, 3, 2, 1, 2, 2, 1, 3, 3, 2, 2, 3, 2, 1, 2, 2, 2, 1, 3, 3, 2, 2, 3, 2, 1, 2, 1, 3, 2, 1, 3, 3, 2, 2, 3, 2, 1, 2, 3, 3, 2
Offset: 1

Views

Author

Clark Kimberling, Apr 13 2015

Keywords

Examples

			R(0) = 0;
R(1) = 1;
R(2) = 4 - 2;
R(3) = 4 - 1;
R(4) = 4;
R(5) = 9 - 4.
		

Crossrefs

Programs

  • Mathematica
    b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}];  (* Squares as base *)
    s[n_] := Table[b[n], {k, 1, 2 n - 1}];
    h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
    g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
    Table[r[n], {n, 0, 120}]; (* A256789 *)
    u = Flatten[Table[Last[r[n]], {n, 1, 1000}]];  (* A256791 *)
    u1 = Select[Range[800], u[[#]] > 0 &]; (* A256792 *)
    u2 = Select[Range[800], u[[#]] < 0 &]; (* A256793 *)
    Differences[u1]  (* A256794 *)
    Differences[u2]  (* A256795 *)

A256795 Difference sequence of A256793.

Original entry on oeis.org

1, 2, 3, 2, 2, 3, 3, 1, 2, 3, 3, 2, 1, 2, 3, 3, 2, 2, 1, 2, 3, 2, 1, 2, 2, 2, 1, 2, 3, 2, 2, 1, 2, 2, 2, 1, 2, 3, 3, 1, 2, 1, 2, 2, 2, 1, 2, 3, 2, 3, 1, 2, 1, 2, 2, 2, 1, 2, 3, 2, 2, 3, 1, 2, 1, 2, 2, 2, 1, 2, 3, 3, 1, 2, 3, 1, 2, 1, 2, 2, 2, 1, 2, 3, 2, 1
Offset: 1

Views

Author

Clark Kimberling, Apr 13 2015

Keywords

Comments

These are the numbers of consecutive positive traces when the minimal alternating squares representations for positive integers are written in order. Is every term < 5? The first term greater than 3 is a(116) = 4, corresponding to these 3 consecutive representations:
R(225) = 225;
R(226) = 256 - 36 + 9 - 4 + 1;
R(227) = 256 - 36 + 9 - 4 + 2.
(See A256789 for definitions.)

Crossrefs

Programs

  • Mathematica
    b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}];  (* Squares as base *)
    s[n_] := Table[b[n], {k, 1, 2 n - 1}];
    h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
    g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
    Table[r[n], {n, 0, 120}]; (* A256789 *)
    u = Flatten[Table[Last[r[n]], {n, 1, 1000}]];  (* A256791 *)
    u1 = Select[Range[800], u[[#]] > 0 &]; (* A256792 *)
    u2 = Select[Range[800], u[[#]] < 0 &]; (* A256793 *)
    Differences[u1]  (* A256794 *)
    Differences[u2]  (* A256795 *)

A256798 Numbers whose minimal alternating squares representation has trace 2 or -2.

Original entry on oeis.org

2, 7, 14, 18, 23, 29, 34, 42, 47, 50, 57, 62, 67, 74, 79, 82, 86, 93, 98, 103, 107, 114, 119, 126, 130, 137, 142, 146, 151, 155, 162, 167, 173, 178, 182, 189, 194, 202, 207, 211, 218, 223, 227, 233, 238, 242, 249, 254, 260, 266, 271, 275, 282, 287, 290, 295
Offset: 1

Views

Author

Clark Kimberling, Apr 13 2015

Keywords

Comments

The trace of all other positive integers is h^2 or -h^2 for some integer h. (See A256789 for definitions and A256791 for traces.)

Examples

			Trace(n) = 2 for n = 7, 14, 23, 34, 47, 62, ..
Trace(n) = -2 for n = 2, 18, 29, 42, 50, 57, 67, ...
Together in increasing order:  2, 7, 14, 18, 23, 29, 34, 42, ...
		

Crossrefs

Programs

  • Mathematica
    b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}];
    s[n_] := Table[b[n], {k, 1, 2 n - 1}];
    h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
    g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
    Table[r[n], {n, 0, 120}]  (* A256789 *)
    u = Flatten[Table[Last[r[n]], {n, 1, 1000}]]; (* A256791 *)
    Select[Range[800], Abs[u[[#]]] == 2 &] (* A256798 *)
Showing 1-6 of 6 results.