A370831 Alternating sum of composites.
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
Keywords
Examples
a(4) = 9 - 8 + 6 - 4 = 3.
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.
Comments