login
a(n) = prime(n) + 2 - (prime(n) mod 4).
4

%I #37 Aug 24 2024 05:54:45

%S 2,2,6,6,10,14,18,18,22,30,30,38,42,42,46,54,58,62,66,70,74,78,82,90,

%T 98,102,102,106,110,114,126,130,138,138,150,150,158,162,166,174,178,

%U 182,190,194,198,198,210,222,226,230,234,238,242,250,258,262,270,270,278

%N a(n) = prime(n) + 2 - (prime(n) mod 4).

%C For k > 1: a(k+1) = a(k) if and only if prime(k) == 1 modulo 4 and prime(k+1) = prime(k) + 2, see A071695 and A071696.

%H G. C. Greubel, <a href="/A082542/b082542.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000040(n) + A070750(n).

%F a(n+1) = p + (-1/p) = p + (-1)^((p-1)/2), where p is the n-th odd prime and (-1/p) denotes the value of Legendre symbol. - _Lekraj Beedassy_, Mar 17 2005

%F a(n) = (A000040(n) OR 3) - 1. - _Jon Maiga_, Nov 14 2018

%F From _Amiram Eldar_, Dec 24 2022: (Start)

%F a(n) = A100484(n) - A076342(n).

%F Product_{n>=1} a(n)/prime(n) = 2/Pi (A060294). (End)

%e a(2) = 2 because the second prime is 3, and 3 + 2 - 3 = 2.

%e a(3) = 6 because the third prime is 5, and 5 + 2 - 1 = 6.

%e a(4) = 6 because the fourth prime is 7, and 7 + 2 - 3 = 6.

%t Table[Prime[n] + 2 - Mod[Prime[n], 4], {n, 60}] (* _Alonso del Arte_, Feb 23 2015 *)

%o (PARI) vector(60, n, 2 + prime(n) - lift(Mod(prime(n),4))) \\ _G. C. Greubel_, Nov 14 2018

%o (Magma) [2 + NthPrime(n) - (NthPrime(n) mod 4): n in [1..60]]; // _G. C. Greubel_, Nov 14 2018

%Y Cf. A000040, A060294, A070750, A076342.

%Y Cf. A039702, A071695, A071696, A100484.

%K nonn,easy

%O 1,1

%A _Reinhard Zumkeller_, May 02 2003