cp's OEIS Frontend

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.

A233809 a(n) = Sum_{k=1..n} prime(k) * s(k), where s(k) = (-1)^(floor(k/2)).

Original entry on oeis.org

2, -1, -6, 1, 12, -1, -18, 1, 24, -5, -36, 1, 42, -1, -48, 5, 64, 3, -64, 7, 80, 1, -82, 7, 104, 3, -100, 7, 116, 3, -124, 7, 144, 5, -144, 7, 164, 1, -166, 7, 186, 5, -186, 7, 204, 5, -206, 17, 244, 15, -218, 21, 262, 11, -246, 17, 286, 15, -262
Offset: 1

Views

Author

Jon Perry, Dec 16 2013

Keywords

Comments

s(k) starts +1, -1, -1, +1, +1, -1, -1, ...

Examples

			a(6) = +2 - 3 - 5 + 7 + 11 - 13 = -1.
		

Crossrefs

Cf. A130642 (a(n) = -1), A130643 (a(n) = 1). - Michel Marcus, Aug 06 2017

Programs

  • Magma
    [&+[NthPrime(k)*(-1)^(Floor(k/2)): k in [1..n]]: n in [1..60]]; // Vincenzo Librandi, Aug 07 2017
  • Mathematica
    f[n_] := Sum[(-1)^Floor[k/2]*Prime[k], {k, n}]; Array[f, 60] (* Robert G. Wilson v, Aug 06 2017 *)
  • PARI
    s(k) = (-1)^(floor(k/2));
    a(n) = sum(k=1,n,s(k)*prime(k));
    \\ Joerg Arndt, Aug 06 2017
    

Extensions

Name corrected by Joerg Arndt, Aug 06 2017