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.

A256791 Trace of n in the minimal alternating squares representation of n.

This page as a plain text file.
%I A256791 #8 Apr 14 2015 11:04:42
%S A256791 0,1,-2,-1,4,-4,1,2,-1,9,-1,4,-4,1,2,-1,16,1,-2,-1,4,-4,1,2,-1,25,1,
%T A256791 -9,1,-2,-1,4,-4,1,2,-1,36,4,-4,1,-9,1,-2,-1,4,-4,1,2,-1,49,-2,-1,4,
%U A256791 -4,1,-9,1,-2,-1,4,-4,1,2,-1,64,-16,1,-2,-1,4,-4,1,-9
%N A256791 Trace of n in the minimal alternating squares representation of n.
%C A256791 See A256789 for definitions.
%C A256791 For each positive integer m, the list of 2m numbers between m^2 and (m+1)^2 is repeated between (m+1)^2 and (m+2)^2.  Consequently, a limiting sequence is formed by reversing the repeated lists.  The limiting sequence is -1, 2, 1, -4, 4, -1, -2, 1, -9, 1, -4, 4, -1, -2, 1, -16, ...
%H A256791 Clark Kimberling, <a href="/A256791/b256791.txt">Table of n, a(n) for n = 0..999</a>
%e A256791 R(0) = 0, so a(0) = 0;
%e A256791 R(1) = 1, so a(1) = 1;
%e A256791 R(2) = 4 - 2, so a(2) = -2;
%e A256791 R(7) = 9 - 4 + 2, so a(7) = 2;
%e A256791 R(89) = 100 - 16 + 9 - 4, so a(89) = -4.
%t A256791 b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}];
%t A256791 s[n_] := Table[b[n], {k, 1, 2 n - 1}];
%t A256791 h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];
%t A256791 g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};
%t A256791 r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
%t A256791 Table[r[n], {n, 0, 120}] (* A256789 *)
%t A256791 Flatten[Table[Last[r[n]], {n, 0, 100}]]  (* A256791 *)
%Y A256791 Cf. A256789.
%K A256791 easy,sign
%O A256791 0,3
%A A256791 _Clark Kimberling_, Apr 13 2015