%I #56 Sep 01 2022 07:15:49
%S 2,1,1,1,1,1,1,1,3,2,1,1,1,1,1,1,3,1,2,1,1,1,1,1,1,6,1,1,1,1,1,2,2,2,
%T 2,1,1,1,1,2,3,2,2,2,1,1,2,1,2,1,2,1,9,1,3,1,1,1,2,1,1,6,1,1,1,1,1,2,
%U 1,5,1,1,1,1,4,3,1,2,1,2,2,1,2,1,14,2,1,3,2,1,2,1,1,7,1,3,2,5,1,2,1
%N Number of solutions to n = +- 1^2 +- 2^2 +- 3^2 +- 4^2 +- ... +- k^2 for minimal k giving at least one solution.
%C This type of sequence was first studied by Andrica and Vacaretu. - _Jonathan Sondow_, Nov 06 2013
%H Alois P. Heinz, <a href="/A231071/b231071.txt">Table of n, a(n) for n = 0..10000</a>
%H Dorin Andrica and Daniel Vacaretu, <a href="http://www.cs.ubbcluj.ro/~studia-m/2006-4/andrica.pdf">Representation theorems and almost unimodal sequences</a>, Studia Univ. Babes-Bolyai, Mathematica, Vol. LI, 4 (2006), 23-33.
%F From _Jonathan Sondow_, Nov 03 2013: (Start)
%F a(n(n+1)(2n+1)/6) = 1 for n > 0: n(n+1)(2n+1)/6 = 1+4+9+...+n^2. See A000330.
%F a(n(n+1)(2n+1)/6 - 2) = 1 for n > 1: n(n+1)(2n+1)/6 - 2 = -1+4+9+...+n^2. (End)
%e a(8) = 3: 8 = -1-4-9-16+25-36+49 = -1-4+9+16-25-36+49 = -1+4+9-16+25+36-49.
%e a(9) = 2: 9 = -1-4+9+16+25-36 = 1+4+9-16-25+36.
%e a(10) = 1: 10 = -1+4-9+16.
%p b:= proc(n, i) option remember; (m->`if`(n>m, 0, `if`(n=m, 1,
%p b(n+i^2, i-1) +b(abs(n-i^2), i-1))))((1+(3+2*i)*i)*i/6)
%p end:
%p a:= proc(n) local k; for k while b(n, k)=0 do od; b(n, k) end:
%p seq(a(n), n=0..100);
%t b[n_, i_] := b[n, i] = Function[m, If[n > m, 0, If[n == m, 1,
%t b[n+i^2, i-1] + b[Abs[n-i^2], i-1]]]][(1+(3+2*i)*i)*i/6];
%t a[n_] := Module[{k}, For[k = 1, b[n, k] == 0, k++]; b[n, k]];
%t Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Sep 01 2022, after _Alois P. Heinz_ *)
%Y Cf. A000330, A231015, A231272.
%Y Cf. A083527, A158092 (extremal sums).
%K nonn,look
%O 0,1
%A _Alois P. Heinz_, Nov 03 2013
|