login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A256789 R(k), the minimal alternating squares representation of k, concatenated for k = 0, 1, 2,.... 13
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
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.
LINKS
EXAMPLE
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
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 *)
CROSSREFS
Cf. A000290, A256655, A256696, A244974, A256780 (number of terms), A256791 (trace).
Sequence in context: A176895 A335261 A351864 * A226577 A179950 A016514
KEYWORD
easy,sign
AUTHOR
Clark Kimberling, Apr 13 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 20:33 EDT 2024. Contains 371916 sequences. (Running on oeis4.)