%I #17 May 24 2022 17:12:18
%S 2,4,3,3,3,8,7,7,7,7,7,7,7,16,15,15,15,20,19,19,19,19,19,19,19,19,19,
%T 19,19,19,19,19,19,19,19,19,19,40,39,39,39,44,43,43,43,43,43,43,43,43,
%U 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43
%N a(1) = 2, a(n) = Min(n,a(n-1)) if gcd(n,a(n-1)) = 1, else a(n) = n + 2.
%e a(1) = 2, gcd(2,2) = 2 thus a(2) = 4
%e a(2) = 4, gcd(3,4) = 1 thus a(3) = Min(3,4) = 3
%e a(3) = 3, gcd(4,3) = 1 thus a(4) = Min(4,3) = 3, etc.
%t a[1] = 2; a[n_] := a[n] = If[CoprimeQ[n, a[n - 1]], Min[n, a[n - 1]], n + 2]; Array[a, 100] (* _Amiram Eldar_, Apr 11 2022 *)
%o (Python)
%o from math import gcd
%o from itertools import count, islice
%o def A352962_gen(): # generator of terms
%o a = 2
%o yield a
%o for n in count(2):
%o yield (a:= min(n,a) if gcd(n,a) == 1 else n+2)
%o A352962_list = list(islice(A352962_gen(),30)) # _Chai Wah Wu_, May 24 2022
%Y Cf. A000040, A201854.
%K nonn
%O 1,1
%A _Ctibor O. Zizka_, Apr 11 2022