login
A380894
a(1) = 0; a(2) = 1; for n > 2, a(n) = a(n-1) + least unique positive difference of two earlier terms.
1
0, 1, 2, 4, 7, 11, 16, 22, 32, 44, 58, 76, 96, 121, 147, 177, 208, 241, 277, 314, 352, 392, 435, 480, 527, 579, 636, 694, 754, 815, 878, 943, 1014, 1086, 1159, 1235, 1312, 1390, 1470, 1551, 1634, 1719, 1806, 1894, 1989, 2085, 2185, 2286, 2389, 2494, 2600, 2709
OFFSET
1,3
COMMENTS
For a(1) = k and a(2) = k + 1 the sequence is shifted by +k.
FORMULA
For n > 2, a(n) < (a(n+1) - a(n-1))/2.
EXAMPLE
a(4) = 4 because a(3) = 2 and the difference 2 - 0 = 2 is unique and the difference 2 - 1 = 1 - 0 = 1 is not unique.
a(9) = 32 because a(8) = 22 and the difference 11 - 1 = 10 is unique, the differences 1, 2, 3, 4, 5, 6, 7, 9 are not unique and the difference 8 does not exist.
MAPLE
A380894:=proc(N)
local i, j, L, M;
M:=[0, 1];
L:=[M[2]-M[1]];
i:=2;
while i<=N-1 do
for j to i-2 do
L:=[op(L), M[i]-M[j]];
od;
L:=sort(L);
while numboccur(L[1], L)>1 do
L:=remove(x->x=L[1], L);
od;
M:=[op(M), M[i]+L[1]];
L:=subsop(1=NULL, L);
i:=i+1;
od;
return op(M)
end proc;
A380894(52);
MATHEMATICA
a[1] = 0; a[2] = 1; a[n_Integer] := a[n] = Module[{data = Array[a, n - 1, 1], len}, len = Length[data]; a[n - 1] + MinimalBy[DeleteCases[Tally[ResourceFunction["FlatTable"][data[[i]] - data[[j]], {j, 1, len - 1}, {i, j + 1, len}]], _?(#[[2]] > 1 &)], First][[1, 1]]]; Array[a, 52, 1] (* Shenghui Yang, Feb 18 2025 *)
CROSSREFS
Cf. A000045 (Fibonacci numbers), A002858 (Ulam numbers with a(1) = 1 and a(2) = 2).
Sequence in context: A212365 A131075 A365698 * A133523 A114805 A196722
KEYWORD
nonn
AUTHOR
Felix Huber, Feb 10 2025
STATUS
approved