login
A370831
Alternating sum of composites.
0
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,1
COMMENTS
Unlike equivalent sequence for primes, A008347, there are repeated terms.
FORMULA
a(n) = A002808(n) - a(n-1), for n>1.
EXAMPLE
a(4) = 9 - 8 + 6 - 4 = 3.
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}]
CROSSREFS
Sequence in context: A246879 A302794 A247361 * A297307 A163238 A097362
KEYWORD
nonn
AUTHOR
James C. McMahon, Mar 02 2024
STATUS
approved