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.

A377371 a(n) = k*(a(n-1)+n), k=-1 for prime n, otherwise k=1 (a(1)=1).

Original entry on oeis.org

1, -3, 0, 4, -9, -3, -4, 4, 13, 23, -34, -22, 9, 23, 38, 54, -71, -53, 34, 54, 75, 97, -120, -96, -71, -45, -18, 10, -39, -9, -22, 10, 43, 77, 112, 148, -185, -147, -108, -68, 27, 69, -112, -68, -23, 23, -70, -22, 27, 77, 128, 180, -233, -179, -124, -68, -11
Offset: 1

Views

Author

Bill McEachen, Dec 27 2024

Keywords

Comments

From the infinitude of the primes, k<0 will always be seen, and the +/- halves of the graph are essentially mirror images. The number of sign changes through n should be on the order of primepi(n).

Examples

			a(1)=1. For n=2 (prime), a(2) = -(1+2) = -3. For n=3 (prime), a(3) = -(-3+3) = 0.
		

Programs

  • Mathematica
    j = 1; {j}~Join~Reap[Do[k = (1 - 2 Boole[PrimeQ[n]])*(j + n); j = Sow[k], {n, 2, 57}] ][[-1, 1]] (* Michael De Vlieger, Dec 28 2024 *)

Formula

a(n) = a(n-1) + n for composite n, else -(a(n-1) + n).