login
A309107
A member of a family of generalizations of van Eck's sequence as defined below.
0
0, 0, 0, 2, 0, 2, 2, 3, 0, 4, 0, 2, 5, 0, 3, 7, 0, 3, 3, 4, 10, 0, 5, 10, 3, 6, 0, 5, 5, 6, 4, 11, 0, 6, 4, 4, 5, 8, 0, 6, 6, 7, 26, 0, 5, 8, 8, 9, 0, 5, 5, 6, 11, 21, 0, 6, 4, 21, 4, 2, 48, 0, 7, 21, 6, 9, 18, 0, 6, 4, 11, 18, 5, 22, 0, 7, 13, 0, 3, 54, 0, 3, 3, 4, 14, 0, 5, 14, 3, 6, 21, 27, 0, 7, 18, 23, 0, 4, 14, 11
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
Cf. A181391.
Sequence in context: A061199 A352128 A334203 * A366353 A366354 A144741
KEYWORD
easy,nonn
AUTHOR
Christian Schroeder, Jul 12 2019
STATUS
approved