login
If n-th prime is 4m - 1, then a(n) = 4m + 1. If n-th prime is 4m + 1, then a(n) = 4m - 1.
2

%I #20 Dec 26 2017 01:25:43

%S 5,3,9,13,11,15,21,25,27,33,35,39,45,49,51,61,59,69,73,71,81,85,87,95,

%T 99,105,109,107,111,129,133,135,141,147,153,155,165,169,171,181,179,

%U 193,191,195,201,213,225,229,227,231,241,239,253,255,265,267,273,275,279

%N If n-th prime is 4m - 1, then a(n) = 4m + 1. If n-th prime is 4m + 1, then a(n) = 4m - 1.

%H Robert Israel, <a href="/A108245/b108245.txt">Table of n, a(n) for n = 2..10000</a>

%e 11, the 5th prime, is of the form 4m - 1, so a(5) = 4m + 1 = 13.

%p a:=proc(n) if ithprime(n) mod 4 = 3 then ithprime(n)+2 else ithprime(n)-2 fi end: seq(a(n),n=2..75); # _Emeric Deutsch_, Jun 19 2005

%t Array[Total[QuotientRemainder[Prime@ #, 4] /. {q_, r_} /; OddQ@ r :> If[r == 1, {4 (q - 1), 3}, {4 (q + 1), 1}]] &, 59, 2] (* _Michael De Vlieger_, Dec 23 2017 *)

%t Table[Prime[n] + 2(Mod[Prime[n], 4] - 2), {n, 2, 63}] (* _Alonso del Arte_, Dec 23 2017 *)

%Y Cf. A107323.

%K nonn

%O 2,1

%A _Leroy Quet_, Jun 17 2005

%E More terms from _Emeric Deutsch_, Jun 19 2005