OFFSET
1,3
COMMENTS
For a(1) = k and a(2) = k + 1 the sequence is shifted by +k.
LINKS
Felix Huber, Table of n, a(n) for n = 1..1000
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
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
KEYWORD
nonn
AUTHOR
Felix Huber, Feb 10 2025
STATUS
approved
