OFFSET
1,3
COMMENTS
a(n) < n for all n follows from the definition.
2 seems to be the most frequently occurring term (51470 times in the first 16*10^6 terms).
In general a zero term occurs in two distinct ways: (i). Subsequent to 1,k where 1 is a repeat term and k is novel, which leads to 1,k,k then 0; (ii). k, k-1 where k-1 is novel. The former seems to happen much more frequently than the latter.
Conjecture: all numbers eventually appear.
Open questions: Does every number which occurs, occur again? Why is 2 the most frequently occurring term? Does 0 occur infinitely many times?
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^16, showing records in red and representing zeros instead as 1/2.
EXAMPLE
a(1,2) = 0,1 and since 1 is novel a(3) = |1-0+1| = 2.
Since a(3) = 2 is a novel term, a(4) = |2-1+1| = 2.
a(3,4) = 2,2 implies a(5) = 0.
a(36,37) = 12,11 and since 11 is novel, a(38) = |11-12+1| = 0.
a(23,24,25,26,27,28,29,30,31,32) = 1,6,4,7,4,1,4,1,1,0 (1,4 are repeat terms, 7 is novel). This is an exceptional occurrence of 0 outside the two categories mentioned in Comments. It is not known if there are other exceptions.
MATHEMATICA
c[_] := 0; nn = 2^26 + 1; a[1] = i = 0; a[2] = j = 1; c[0] = 1;
Do[If[c[j] <= 0,
k = Abs[j - i + 1],
k = n - c[j] - 2];
Set[{a[n], c[j], i, j}, {k, n - 1, j, k}], {n, 3, nn}];
Array[a, nn] (* Michael De Vlieger, Dec 14 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Nov 28 2023
STATUS
approved