Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #28 Jan 28 2023 18:12:45
%S 1,3,20,11,24,5,6,39,98,29,120,23,64,13,104,15,1716,323,284,499,62,
%T 1099,1264,215,1274,51,512,447,1768,209,1332,31,32,373,34,1475,258,
%U 835,2300,519,5780,419,5374,1275,6974,1655,6626,479,10240,10549,3008,883,13938
%N a(n) is the smallest number x such that gcd(prime(x)+1,x+1) = n.
%C a(n) == n+1 (mod 2). - _Robert Israel_, May 04 2017
%H Ivan Neretin, <a href="/A084316/b084316.txt">Table of n, a(n) for n = 1..4000</a> (first 2880 terms from Robert Israel)
%F a(n) = Min{x; A066752(x)=n}.
%e In A066752, n=5 arises first at the 24th position, so a(5)=24.
%p f:= proc(n) local x;
%p for x from n-1 by ilcm(n,2) do
%p if igcd(x+1, ithprime(x)+1) = n then return x fi
%p od
%p end proc:
%p f(1):= 1:
%p map(f, [$1..100]); # _Robert Israel_, May 04 2017
%t f[x_]:=GCD[Prime[x]+1,x+1]; t=Table[0,{256}];Do[s=f[n];If[s<257&&t[[s]] == 0,t[[s]] = n],{n,1,100000}];t (* edited by _Harvey P. Dale_, Jan 28 2023 *)
%t Module[{nn=20000,t},t=Table[{x,GCD[Prime[x]+1,x+1]},{x,nn}];Table[SelectFirst[t,#[[2]]==n&],{n,60}]][[All,1]] (* _Harvey P. Dale_, Jan 28 2023 *)
%Y Cf. A000040, A066752, A084309-A084315.
%K nonn
%O 1,2
%A _Labos Elemer_, Jun 13 2003