%I #23 Jul 31 2023 19:13:18
%S 1,2,3,5,7,5,7,12,15,12,15,12,15,25,15,25,31,25,31,25,31,25,31,25,31,
%T 25,31,52,31,52,31,52,63,52,63,52,63,52,63,52,63,52,63,52,63,52,63,52,
%U 63,52,63,52,63,105,63,105,63,105,63,105,63,105,63,105,127,105,127,105,127,105,127,105,127,105,127,105,127,105,127,105
%N a(1)=1, a(2)=2; for n > 1, a(n+1) = (a(n-1) mod n) + n.
%H Robert Israel, <a href="/A284630/b284630.txt">Table of n, a(n) for n = 1..10000</a>
%e a(3) = a(1) (mod 2) + 2 = 3.
%p A[1]:= 1: A[2]:= 2:
%p for n from 3 to 200 do A[n]:= (A[n-2] mod (n-1)) + n-1 od:
%p seq(A[n],n=1..200); # _Robert Israel_, Apr 04 2017
%t a[n_] := a[n] = If[n < 3, n, Mod[a[n - 2], n - 1] + n - 1]; Array[a, 80] (* _Michael De Vlieger_, Apr 02 2017 *)
%t nxt[{n_,a_,b_}]:={n+1,b,Mod[a,n]+n}; NestList[nxt,{2,1,2},100][[;;,2]] (* _Harvey P. Dale_, Jul 31 2023 *)
%o (PARI) a(n) = if (n<=2, n, (n-1) + a(n-2) % (n-1)); \\ _Michel Marcus_, Apr 02 2017
%Y Cf. A003817.
%K nonn,easy,look
%O 1,2
%A _Thomas Kerscher_, Mar 31 2017