login
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

%I #21 Oct 24 2022 14:13:50

%S 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,

%T 51,27,42,29,59,31,48,33,56,35,71,37,75,39,79,41,63,71,44,89,46,93,72,

%U 81,50,101,78,53,107,55,111,91,58,117,90,61,123,63,106,65,131,67

%N 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.

%H Joseph Bove, <a href="/A357897/b357897.txt">Table of n, a(n) for n = 1..20000</a>

%e For n=12, a(12)=12+6 as a(6) is the first term to equal 11.

%o (MATLAB)

%o function a = A357897( max_n )

%o a = 1;

%o for n = 2:max_n

%o f = find(a == n-1, 1);

%o a(n) = n + max([f 0]);

%o end

%o end % _Thomas Scheuerle_, Oct 19 2022

%K nonn

%O 1,2

%A _Joseph Bove_, Oct 19 2022