Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #11 Jan 17 2025 09:42:56
%S 1,2,2,1,1,4,1,2,2,1,1,4,1,2,3,2,1,4,1,2,2,1,1,4,2,1,1,2,1,6,1,2,2,1,
%T 1,4,1,2,2,1,1,4,1,2,3,2,1,4,1,2,2,1,1,4,2,1,1,2,1,6,1,2,2,1,1,4,1,2,
%U 2,1,1,4,1,2,3,2,1,4,1,2,2,1,1,4,2,1,1,2,1,6,3,2,2,1,1,4,1,2,2,1,1,4,1,2,5
%N a(1) = 1; a(n) is smallest positive integer such that a(n)*a(n-1)+1 is coprime to n.
%H Antti Karttunen, <a href="/A100996/b100996.txt">Table of n, a(n) for n = 1..65537</a>
%t a[1] = 1; a[n_] := a[n] = Block[{k = 1}, While[ GCD[k*a[n - 1] + 1, n] != 1, k++ ]; k]; Table[ a[n], {n, 105}]
%o (PARI)
%o up_to = 65537;
%o A100996list(up_to_n) = { my(v=vector(up_to_n)); v[1] = 1; for(n=2,#v,for(k=1,oo,if(1==gcd(1+(k*v[n-1]), n), v[n] = k; break))); (v); };
%o v100996 = A100996list(up_to);
%o A100996(n) = v100996[n]; \\ _Antti Karttunen_, Jan 17 2025
%K nonn,changed
%O 1,2
%A _Leroy Quet_, Jan 13 2005
%E More terms from _Robert G. Wilson v_, Feb 11 2005