OFFSET
1,4
COMMENTS
For n >= 1, if there exists an m < n-1 such that a(m) = a(n), take the largest such m and set a(n+1) = n-m; otherwise a(n+1) = 0. Start with a(1) = a(2) = 0.
T: let 0 <= k < l. For n > k, if there exists an m <= n-l such that a(m) = a(n-k), take the largest such m and set a(n+1) = n-m; otherwise a(n+1) = 0. Start with a(1) = ... = a(l) = 0. Setting k = 0, l = 1 produces van Eck's sequence A181391; setting k = 0, l = 2 produces this sequence.
PROG
(MATLAB)
function VEg = VE_generalized(N, k, l)
assert(l > k);
VEg = zeros(1, l);
for n = l:(N - 1)
prev = VEg(n - k);
VEg(n + 1) = 0;
for j = (n - l):-1:1
if VEg(j) == prev
VEg(n + 1) = n - j;
break
end
end
end
end
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Christian Schroeder, Jul 12 2019
STATUS
approved