OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..3000
Andrica, D., Vacaretu, D., Representation theorems and almost unimodal sequences, Studia Univ. Babes-Bolyai, Mathematica, Vol. LI, 4 (2006), 23-33.
EXAMPLE
10 is member of the sequence with unique minimal solution 10 = -1+4-9+16.
A000330(k) = k(k+1)(2k+1)/6 = 1^2 + 2^2 + ... + k^2 is a member for k > 0. - Jonathan Sondow, Nov 06 2013
MAPLE
b:= proc(n, i) option remember; local m, t; m:= (1+(3+2*i)*i)*i/6;
if n>m then 0 elif n=m then 1 else
t:= b(abs(n-i^2), i-1);
if t>1 then return 2 fi;
t:= t+b(n+i^2, i-1); `if`(t>1, 2, t)
fi
end:
a:= proc(n) option remember; local m, k;
for m from 1+ `if`(n=1, -1, a(n-1)) do
for k while b(m, k)=0 do od;
if b(m, k)=1 then return m fi
od
end:
seq(a(n), n=1..80);
MATHEMATICA
b[n_, i_] := b[n, i] = Module[{m, t}, m = (1 + (3 + 2*i)*i)*i/6; If[n > m, 0, If[n == m, 1, t = b[Abs[n - i^2], i - 1]; If[t > 1, Return[2]]; t = t + b[n + i^2, i - 1]; If[t > 1, 2, t]]]];
a[n_] := a[n] = Module[{m, k}, For[m = 1 + If[n == 1, -1, a[n - 1]], True, m++, For[k = 1, b[m, k] == 0, k++]; If[b[m, k] == 1, Return[m]]]];
Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Sep 01 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 06 2013
STATUS
approved