Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #27 Sep 08 2022 08:45:50
%S 1,4,4,8,10,14,16,20,22,30,30,38,40,44,46,54,58,62,66,72,72,80,82,90,
%T 96,102,102,108,108,114,126,132,136,140,148,152,156,164,166,174,178,
%U 182,190,194,196,200,210,224,226,230,232,240,240,252,256,264,268,272,276
%N a(n) = prime(n) + (-1)^n.
%C 1 together with A014687.
%F a(n+1) = A014687(n).
%e a(1) = prime(1) + (-1)^1 = 2 - 1 = 1.
%p A172022:=n->ithprime(n)+(-1)^n: seq(A172022(n), n=1..100); # _Wesley Ivan Hurt_, Jan 09 2017
%t upto=300;Total/@Partition[Riffle[Prime[Range[PrimePi[upto]]], {-1,1}], 2] (* _Harvey P. Dale_, May 12 2011 *)
%t Table[Prime@ n + (-1)^n, {n, 59}] (* _Michael De Vlieger_, Jan 10 2017 *)
%o (PARI) a(n)=prime(n)+(-1)^n \\ _Charles R Greathouse IV_, May 12 2011
%o (PARI) k=1; forprime(p=2,300, print1(p+(k*=-1)", ")) \\ _Charles R Greathouse IV_, May 25 2011
%o (Magma) [NthPrime(n) + (-1)^n: n in [1..60]]; // _Vincenzo Librandi_, Feb 13 2015
%Y Cf. A000040, A014687.
%K nonn,easy
%O 1,2
%A _Juri-Stepan Gerasimov_, Jan 22 2010
%E Entries checked by _D. S. McNeil_, Dec 01 2010