This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A172022 #27 Sep 08 2022 08:45:50 %S A172022 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 A172022 96,102,102,108,108,114,126,132,136,140,148,152,156,164,166,174,178, %U A172022 182,190,194,196,200,210,224,226,230,232,240,240,252,256,264,268,272,276 %N A172022 a(n) = prime(n) + (-1)^n. %C A172022 1 together with A014687. %F A172022 a(n+1) = A014687(n). %e A172022 a(1) = prime(1) + (-1)^1 = 2 - 1 = 1. %p A172022 A172022:=n->ithprime(n)+(-1)^n: seq(A172022(n), n=1..100); # _Wesley Ivan Hurt_, Jan 09 2017 %t A172022 upto=300;Total/@Partition[Riffle[Prime[Range[PrimePi[upto]]], {-1,1}], 2] (* _Harvey P. Dale_, May 12 2011 *) %t A172022 Table[Prime@ n + (-1)^n, {n, 59}] (* _Michael De Vlieger_, Jan 10 2017 *) %o A172022 (PARI) a(n)=prime(n)+(-1)^n \\ _Charles R Greathouse IV_, May 12 2011 %o A172022 (PARI) k=1; forprime(p=2,300, print1(p+(k*=-1)", ")) \\ _Charles R Greathouse IV_, May 25 2011 %o A172022 (Magma) [NthPrime(n) + (-1)^n: n in [1..60]]; // _Vincenzo Librandi_, Feb 13 2015 %Y A172022 Cf. A000040, A014687. %K A172022 nonn,easy %O A172022 1,2 %A A172022 _Juri-Stepan Gerasimov_, Jan 22 2010 %E A172022 Entries checked by _D. S. McNeil_, Dec 01 2010