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-3 of 3 results.

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

Original entry on oeis.org

0, 1, 2, 4, -1, 4, 8, -4, 1, 8, -2, 8, -1, 8, 16, -8, 1, 16, -8, 2, 16, -8, 4, -1, 16, -4, 16, -4, 1, 16, -2, 16, -1, 16, 32, -16, 1, 32, -16, 2, 32, -16, 4, -1, 32, -16, 4, 32, -16, 8, -4, 1, 32, -16, 8, -2, 32, -16, 8, -1, 32, -8, 32, -8, 1, 32, -8, 2, 32
Offset: 0

Views

Author

Clark Kimberling, Apr 09 2015

Keywords

Comments

Suppose that b = (b(0), b(1), ... ) is an increasing sequence of positive integers satisfying b(0) = 1 and b(n+1) <= 2*b(n) for n >= 0. Let B(n) be the least b(m) >= n. Let R(0) = 1, and for n > 0, let R(n) = B(n) - R(B(n) - n). The resulting sum of the form R(n) = B(n) - B(m(1)) + B(m(2)) - ... + ((-1)^k)*B(k) is the minimal alternating b-representation of n. The sum B(n) + B(m(2)) + ... is the positive part of R(n), and the sum B(m(1)) + B(m(3)) + ... , the nonpositive part of R(n). The number ((-1)^k)*B(k) is the trace of n.
If b(n) = 2^n, the sum R(n) is the minimal alternating binary representation of n.
A055975 = trace of n, for n >= 1.
A091072 gives the numbers having positive trace.
A091067 gives the numbers having negative trace.
A072339 = number of terms in R(n).
A073122 = sum of absolute values of the terms in R(n).

Examples

			R(0) = 0
R(1) = 1
R(2) = 2
R(3) = 4 - 1
R(4) = 4
R(9) = 8 - 4 + 1
R(11) = 16 - 8 + 4 - 1
		

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1981, Vol. 2 (2nd ed.), p. 196, Exercise 27.

Crossrefs

Programs

  • Mathematica
    z = 100; b[n_] := 2^n; bb = Table[b[n], {n, 0, 40}];
    s[n_] := Table[b[n + 1], {k, 1, b[n]}];
    h[0] = {1}; h[n_] := Join[h[n - 1], s[n - 1]];
    g = h[10]; r[0] = {0};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]]
    u = Flatten[Table[r[n], {n, 0, z}]]

A256702 Nonpositive part of the minimal alternating binary representation of n (defined at A256696).

Original entry on oeis.org

0, 0, 1, 0, 4, 2, 1, 0, 8, 8, 9, 4, 4, 2, 1, 0, 16, 16, 17, 16, 20, 18, 17, 8, 8, 8, 9, 4, 4, 2, 1, 0, 32, 32, 33, 32, 36, 34, 33, 32, 40, 40, 41, 36, 36, 34, 33, 16, 16, 16, 17, 16, 20, 18, 17, 8, 8, 8, 9, 4, 4, 2, 1, 0, 64, 64, 65, 64, 68, 66, 65, 64, 72
Offset: 1

Views

Author

Clark Kimberling, Apr 09 2015

Keywords

Examples

			R(1) = 1; positive part 1, nonpositive part 0.
R(2) = 2; positive part 2, nonpositive part 0.
R(3) = 4 - 1; positive part 4, nonpositive part 1.
R(11) = 16 - 8 + 4 - 1; positive part 16 + 4 = 20; nonpositive part 8 + 1 = 9.
		

Crossrefs

Programs

  • Mathematica
    b[n_] := 2^n; bb = Table[b[n], {n, 0, 40}];
    s[n_] := Table[b[n + 1], {k, 1, b[n]}];
    h[0] = {1}; h[n_] := Join[h[n - 1], s[n - 1]];
    g = h[10]; Take[g, 100]; r[0] = {0};
    r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]]
    Table[Total[Abs[r[n]]], {n, 1, 100}] (* A073122 *)
    u = Table[Total[(Abs[r[n]] + r[n])/2], {n, 1, 100}]  (* A256701 *)
    v = Table[Total[(Abs[r[n]] - r[n])/2], {n, 1, 100}]  (* A256702 *)

Formula

A256701(n) - A256702(n) = n.

A256759 Nonpositive part of the minimal alternating triangular-number representation of n (defined at A255974).

Original entry on oeis.org

0, 1, 0, 3, 1, 0, 3, 3, 1, 0, 7, 3, 3, 1, 0, 6, 7, 3, 3, 1, 0, 6, 6, 7, 3, 3, 1, 0, 10, 6, 6, 7, 3, 3, 1, 0, 11, 10, 6, 6, 7, 3, 3, 1, 0, 10, 11, 10, 6, 6, 7, 3, 3, 1, 0, 10, 10, 11, 10, 6, 6, 7, 3, 3, 1, 0, 18, 10, 10, 11, 10, 6, 6, 7, 3, 3, 1, 0, 15, 18
Offset: 1

Views

Author

Clark Kimberling, Apr 13 2015

Keywords

Examples

			R(1) = 1; positive part 1, nonpositive part 0
R(2) = 3 - 1; positive part 3, nonpositive part 1
R(3) = 3; positive part 3, nonpositive part 0
R(11) = 15 - 6 + 3 - 1; positive part 15+3 = 18; nonpositive part 6 + 1 = 7
		

Crossrefs

Programs

  • Mathematica
    b[n_] := n (n + 1)/2; bb = Table[b[n], {n, 0, 1000}];
    s[n_] := Table[b[n], {k, 1, 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[g[[n]] - n]]];
    Table[Total[(Abs[r[n]] + r[n])/2], {n, 1, 120}]  (* A256700 *)
    Table[Total[(Abs[r[n]] - r[n])/2], {n, 1, 120}]  (* A256759 *)

Formula

A256700(n) - A256759(n) = n.
Showing 1-3 of 3 results.