login
A357897
a(1)=1; thereafter a(n)=n+k, where k is the minimal value of k such that a(k)=n-1 and k belongs to [1, n-1], or k=0 if no such value exists.
1
1, 3, 3, 6, 5, 11, 11, 8, 17, 10, 21, 18, 13, 27, 15, 31, 17, 27, 31, 20, 41, 33, 23, 47, 25, 51, 27, 42, 29, 59, 31, 48, 33, 56, 35, 71, 37, 75, 39, 79, 41, 63, 71, 44, 89, 46, 93, 72, 81, 50, 101, 78, 53, 107, 55, 111, 91, 58, 117, 90, 61, 123, 63, 106, 65, 131, 67
OFFSET
1,2
EXAMPLE
For n=12, a(12)=12+6 as a(6) is the first term to equal 11.
PROG
(MATLAB)
function a = A357897( max_n )
a = 1;
for n = 2:max_n
f = find(a == n-1, 1);
a(n) = n + max([f 0]);
end
end % Thomas Scheuerle, Oct 19 2022
CROSSREFS
Sequence in context: A038167 A307967 A131077 * A342511 A175520 A271668
KEYWORD
nonn
AUTHOR
Joseph Bove, Oct 19 2022
STATUS
approved