login
Primes in the sequence a(n)=n^2+3/2-1/2*(-1)^n.
0

%I #9 Nov 17 2023 12:33:51

%S 3,5,11,17,37,83,101,197,227,257,401,443,577,677,1091,1297,1523,1601,

%T 2027,2917,3137,3251,4357,5477,6563,7057,8101,8837,9803,11027,12101,

%U 12323,13457,13691,14401,15131,15377,15877,16901,17957,21317,21611

%N Primes in the sequence a(n)=n^2+3/2-1/2*(-1)^n.

%C 3/2 - (-1)^n/2 adds 1 for any even number and 2 for any odd number.

%e 5 is a member because 2^2+3/2-1/2=5

%p P:=proc(n) local i,j; for i from 0 by 1 to n do j:=i^2+3/2-1/2*(-1)^i; if isprime(j) then print(j); fi; od; end: P(200);

%t Select[Table[n^2+3/2-1/(2(-1)^n),{n,200}],PrimeQ] (* _Harvey P. Dale_, Dec 21 2011 *)

%K easy,nonn

%O 1,1

%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Dec 31 2006