OFFSET
1,2
COMMENTS
1 together with A014687.
FORMULA
a(n+1) = A014687(n).
EXAMPLE
a(1) = prime(1) + (-1)^1 = 2 - 1 = 1.
MAPLE
MATHEMATICA
upto=300; Total/@Partition[Riffle[Prime[Range[PrimePi[upto]]], {-1, 1}], 2] (* Harvey P. Dale, May 12 2011 *)
Table[Prime@ n + (-1)^n, {n, 59}] (* Michael De Vlieger, Jan 10 2017 *)
PROG
(PARI) a(n)=prime(n)+(-1)^n \\ Charles R Greathouse IV, May 12 2011
(PARI) k=1; forprime(p=2, 300, print1(p+(k*=-1)", ")) \\ Charles R Greathouse IV, May 25 2011
(Magma) [NthPrime(n) + (-1)^n: n in [1..60]]; // Vincenzo Librandi, Feb 13 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Juri-Stepan Gerasimov, Jan 22 2010
EXTENSIONS
Entries checked by D. S. McNeil, Dec 01 2010
STATUS
approved