login
a(n) = n-th prime from among those primes which are coprime to n.
4

%I #22 Sep 28 2023 02:06:10

%S 2,5,7,11,13,19,19,23,29,37,37,43,43,53,59,59,61,71,71,79,83,89,89,

%T 101,101,107,107,113,113,137,131,137,149,151,157,163,163,173,179,181,

%U 181,197,193,199,211,223,223,229,229,239,241,251,251,263,269,271,277,281

%N a(n) = n-th prime from among those primes which are coprime to n.

%H Robert Israel, <a href="/A119993/b119993.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000040(n + A001221(n)). - _Jon Maiga_, Jan 05 2019

%e 5,7,11,13,17,19,23,... is the sequence of primes which are coprime to 6. 19 is the 6th such prime, so a(6) = 19.

%p f:= n -> ithprime(n + nops(numtheory:-factorset(n)));

%p map(f, [$1..100]); # _Robert Israel_, Sep 28 2023

%t With[{prs=Prime[Range[1000]]},Table[Select[prs,CoprimeQ[#,n]&][[n]],{n,60}]] (* _Harvey P. Dale_, Aug 27 2014 *)

%t Table[Prime[n + PrimeNu[n]], {n, 60}] (* _Jon Maiga_, Jan 05 2019 *)

%o (PARI) {m=59; for(n=1, m, q=2; k=n; while(k>0, p=q; if(gcd(p,n)==1, k--); q=nextprime(p+1)); print1(p,","))} \\ _Klaus Brockhaus_, Aug 15 2006

%Y Cf. A000040, A001221.

%K nonn

%O 1,1

%A _Leroy Quet_, Aug 03 2006

%E More terms from _Klaus Brockhaus_, Aug 15 2006