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.

A256913 Enhanced squares representations for k = 0, 1, 2, ..., concatenated.

This page as a plain text file.
%I A256913 #14 Nov 05 2021 14:33:57
%S A256913 0,1,2,3,4,4,1,4,2,4,3,4,3,1,9,9,1,9,2,9,3,9,4,9,4,1,9,4,2,16,16,1,16,
%T A256913 2,16,3,16,4,16,4,1,16,4,2,16,4,3,16,4,3,1,25,25,1,25,2,25,3,25,4,25,
%U A256913 4,1,25,4,2,25,4,3,25,4,3,1,25,9,25,9,1,36
%N A256913 Enhanced squares representations for k = 0, 1, 2, ...,  concatenated.
%C A256913 Let B = {0,1,2,3,4,9,16,25,...}, so that B consists of the squares together with 2 and 3.  We call B the enhanced basis of squares.  Define R(0) = 0 and R(n) = g(n) + R(n - g(n)) for n > 0, where g(n) is the greatest number in B that is <= n.  Thus, each n has an enhanced squares representation of the form R(n) = b(m(n)) + b(m(n-1)) + ... + b(m(k)), where b(n) > m(n-1) > ... > m(k) > 0, in which the last term, b(m(k)), is the trace.
%C A256913 The least n for which R(n) has 5 terms is given by R(168) = 144 + 16 + 4 + 3 + 1.
%C A256913 The least n for which R(n) has 6 terms is given by R(7224) = 7056 + 144 + 16 + 4 + 3 + 1.
%H A256913 Clark Kimberling, <a href="/A256913/b256913.txt">Table of n, a(n) for n = 0..1000</a>
%e A256913 R(0) = 0
%e A256913 R(1) = 1
%e A256913 R(2) = 2
%e A256913 R(3) = 3
%e A256913 R(4) = 4
%e A256913 R(8) = 4 + 3 + 1
%e A256913 R(24) = 16 + 4 + 3 + 1
%t A256913 b[n_] := n^2; bb = Insert[Table[b[n], {n, 0, 100}]  , 2, 3];
%t A256913 s[n_] := Table[b[n], {k, 1, 2 n + 1}];
%t A256913 h[1] = {0, 1, 2, 3}; h[n_] := Join[h[n - 1], s[n]];
%t A256913 g = h[100]; Take[g, 100]
%t A256913 r[0] = {0}; r[1] = {1}; r[2] = {2}; r[3] = {3}; r[8] = {4, 3, 1};
%t A256913 r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, r[n - g[[n]]]]];
%t A256913 t = Table[r[n], {n, 0, 120}] (* A256913, before concatenation *)
%t A256913 Flatten[t]  (* A256913 *)
%t A256913 Table[Last[r[n]], {n, 0, 120}]    (* A256914 *)
%t A256913 Table[Length[r[n]], {n, 0, 200}]  (* A256915 *)
%o A256913 (Haskell)
%o A256913 a256913 n k = a256913_tabf !! n !! k
%o A256913 a256913_row n = a256913_tabf !! n
%o A256913 a256913_tabf = [0] : tail esr where
%o A256913    esr = (map r [0..8]) ++
%o A256913            f 9 (map fromInteger $ drop 3 a000290_list) where
%o A256913      f x gs@(g:hs@(h:_))
%o A256913        | x < h   = (g : genericIndex esr (x - g)) : f (x + 1) gs
%o A256913        | otherwise = f x hs
%o A256913      r 0 = []; r 8 = [4, 3, 1]
%o A256913      r x = q : r (x - q) where q = [0,1,2,3,4,4,4,4,4] !! x
%o A256913 -- _Reinhard Zumkeller_, Apr 15 2015
%Y A256913 Cf. A000290, A256914 (trace), A256915 (number of terms), A256789 (minimal alternating squares representations).
%Y A256913 Cf. A257053 (primes).
%K A256913 nonn,easy,tabf,nice
%O A256913 0,3
%A A256913 _Clark Kimberling_, Apr 14 2015