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.

A370831 Alternating sum of composites.

Original entry on oeis.org

4, 2, 6, 3, 7, 5, 9, 6, 10, 8, 12, 9, 13, 11, 14, 12, 15, 13, 17, 15, 18, 16, 19, 17, 21, 18, 22, 20, 24, 21, 25, 23, 26, 24, 27, 25, 29, 26, 30, 27, 31, 29, 33, 30, 34, 31, 35, 33, 36, 34, 38, 36, 39, 37, 40, 38, 42, 39, 43, 41, 44, 42, 45, 43, 47, 44, 48, 45, 49, 46
Offset: 1

Views

Author

James C. McMahon, Mar 02 2024

Keywords

Comments

Unlike equivalent sequence for primes, A008347, there are repeated terms.

Examples

			a(4) = 9 - 8 + 6 - 4 = 3.
		

Crossrefs

Programs

  • Mathematica
    Join[{4},a[1]=4;a[n_]:=ResourceFunction["Composite"][n] - a[n-1];Table[a[n],{n,2,70}]] (* or with signs *) R=70;a[1]=4;a[n_]:=a[n-1]-ResourceFunction["Composite"][n] *(-1)^n;Table[a[n],{n,70}]

Formula

a(n) = A002808(n) - a(n-1), for n>1.